How to change the URI (URL) for a remote Git repository?

前端 未结 25 2493
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 00:28

I have a repo (origin) on a USB key that I cloned on my hard drive (local). I moved \"origin\" to a NAS and successfully tested cloning it from here.

I would like to

25条回答
  •  执笔经年
    2020-11-22 01:17

    git remote -v
    # View existing remotes
    # origin  https://github.com/user/repo.git (fetch)
    # origin  https://github.com/user/repo.git (push)
    
    git remote set-url origin https://github.com/user/repo2.git
    # Change the 'origin' remote's URL
    
    git remote -v
    # Verify new remote URL
    # origin  https://github.com/user/repo2.git (fetch)
    # origin  https://github.com/user/repo2.git (push)
    

    Changing a remote's URL

提交回复
热议问题