Changing the Git remote 'push to' default

后端 未结 11 1902
失恋的感觉
失恋的感觉 2020-12-04 05:35

I want to change the Git default remote branch destination so I could just

git push

Instead of:

git push upstream
         


        
11条回答
  •  温柔的废话
    2020-12-04 06:09

    If you did git push origin -u localBranchName:remoteBranchName and on sequentially git push commands, you get errors that then origin doesn't exist, then follow these steps:

    1. git remote -v

    Check if there is any remote that I don't care. Delete them with git remote remove 'name'

    1. git config --edit

    Look for possible signs of a old/non-existent remote. Look for pushdefault:

    [remote]
      pushdefault = oldremote
    

    Update oldremote value and save.

    git push should work now.

提交回复
热议问题