我有这样的git配置:
[remote "origin"]
url = git@bitbucket.org:archie/learn-express.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin <====
merge = refs/heads/master
[remote "znotanto"]
url = https://archie@bitbucket.org/znotanto/learn-express.git
fetch = +refs/heads/*:refs/remotes/znotanto/*
我想把我用箭头显示的部分改为znotanto
。我已经尝试过git branch master --set-upstream-to znotanto/master
,但给我错误
错误:请求的上游分支"znotanto/master"不存在
复制到znotanto
(https://archie@bitbucket.org/znotanto/learn-express.git
(的存储库实际上有一个名为master
的分支吗?
如果是,请使用:
git fetch znotano
让你的Git了解它。这将让你的Git创建你的远程跟踪名称znotanto/master
,之后你可以将znotanto/master
设置为任何分支的上游。
如果没有,您需要首先在znotanto
的Git存储库中创建名称master
,这样您的Git就会看到它,这样您就可以创建远程跟踪名称znotanto/master
。因此,在这种情况下,首先在那里创建分支——具体如何并不重要——然后运行git fetch znotanto
。