步骤:
- 先查看远程有哪些分支
- 删除远程分支,重新关联远程分支
- 最后再git push 到远程分支
git remote -v
git remote rm RedisNote
git remote add origin git@github.com:mrsmallyi/RedisNote.git
git push origin master
过程如下:
Administrator@AFAAW-704071818 MINGW64 ~/Documents/GitHub/RedisNote (master) $ git remote -v RedisNote git@github.com:mrsmallyi/RdisNote.git (fetch) RedisNote git@github.com:mrsmallyi/RdisNote.git (push) origin git@github.com:mrsmallyi/RedisNote.git (fetch) origin git@github.com:mrsmallyi/RedisNote.git (push) Administrator@AFAAW-704071818 MINGW64 ~/Documents/GitHub/RedisNote (master) $ git remote rm RedisNote Administrator@AFAAW-704071818 MINGW64 ~/Documents/GitHub/RedisNote (master) $ git remote -v origin git@github.com:mrsmallyi/RedisNote.git (fetch) origin git@github.com:mrsmallyi/RedisNote.git (push) Administrator@AFAAW-704071818 MINGW64 ~/Documents/GitHub/RedisNote (master) $ git remote rm origin Administrator@AFAAW-704071818 MINGW64 ~/Documents/GitHub/RedisNote (master) $ git remote add origin git@github.com:mrsmallyi/RedisNote.git Administrator@AFAAW-704071818 MINGW64 ~/Documents/GitHub/RedisNote (master) $ git push origin master Enter passphrase for key '/c/Users/Administrator/.ssh/id_rsa': Everything up-to-date