无法将git分支重命名为" master",使用错误的名称推送到远程

时间:2016-05-16 12:27:12

标签: git github version-control branch git-branch

使用this SO帖子作为参考,我能够将master重命名为v1,现在我想将v2分支重命名为{{1} }。我已经从GitHub将默认分支更改为master,但是当我尝试将v1重命名为master时,本地分支重命名很好,但由于某种原因它会推送v2名称远程。这是命令行会话:

v2

如何正确地将Microsoft Windows [Version 10.0.10586] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\Mahi\Documents\GitHub\EasyPlayer>git branch v1 * v2 C:\Users\Mahi\Documents\GitHub\EasyPlayer>git branch -m master C:\Users\Mahi\Documents\GitHub\EasyPlayer>git branch * master v1 C:\Users\Mahi\Documents\GitHub\EasyPlayer>git push origin :v2 To https://github.com/Mahi/EasyPlayer.git - [deleted] v2 C:\Users\Mahi\Documents\GitHub\EasyPlayer>git push origin master Counting objects: 39, done. Delta compression using up to 8 threads. Compressing objects: 100% (19/19), done. Writing objects: 100% (39/39), 8.17 KiB | 0 bytes/s, done. Total 39 (delta 9), reused 39 (delta 9) To https://github.com/Mahi/EasyPlayer.git * [new branch] master -> v2 C:\Users\Mahi\Documents\GitHub\EasyPlayer> 分支重命名为v2

1 个答案:

答案 0 :(得分:1)

尝试并强制使用本地/远程分支关联:

git push -u origin master:master

您对该分支的本地配置可能仍然将v2作为其上游分支。上面的命令行应该重置它。