Git: says origin already exists on “NEW” (init) repository, using shell but installed Github for Windows

前端 未结 3 798
旧巷少年郎
旧巷少年郎 2021-01-30 11:51

I installed Git for Windows, although I am using the shell not the Windows interface.

If I do a git init, and then try and do a

 git remote         


        
3条回答
  •  不知归路
    2021-01-30 12:10

    I'm the developer who put this in. Here's why I added this to the system gitconfig, it's pretty useful!

    ## Because of this change, git fetch knows about PRs
    git fetch
    
    ## Now, I can merge PRs by number
    git merge origin/pr/24
    
    ## See changes from PR #53
    git diff master...origin/pr/53
    
    ## Get the commit log from PR #25
    git log origin/pr/25
    

    Unfortunately, this does have the consequence that the origin remote always exists, even when it doesn't.

    Workaround

    Whenever you see git remote add origin https://..., instead:

    git remote set-url origin https://...
    

提交回复
热议问题