Bitbucket: Why can't I create a master/x branch

橙三吉。 提交于 2019-12-11 02:42:16

问题


(This is done in SourceTree)

I am trying to make some branches (master/dev, master/demo, master/live) but this cannot be pushed. For example, when I try to push master/demo to master/demo then it gives this error:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin master/demo:master/demo
fatal: HttpRequestException encountered.
   An error occurred while sending the request.

POST git-receive-pack (206 bytes)
remote: error: cannot lock ref 'refs/heads/master/demo': 'refs/heads/master' exists; cannot create 'refs/heads/master/demo'        
Pushing to https://x@bitbucket.org/x/x.git
To https://bitbucket.org/x/x.git
 ! [remote rejected] master/demo -> master/demo (failed to update ref)
error: failed to push some refs to 'https://x@bitbucket.org/x/x.git'



Completed with errors, see above.

回答1:


Internally, branches are stored in .git/refs/heads folder as files. If a branch name contains a directory separator, a similar directory is created inside heads. The filesystem on the remote prevents you from having a file called master and a folder named master on the same path, so that's why you get an error.

You need to use something else than master as the prefix for your branches.



来源:https://stackoverflow.com/questions/54229866/bitbucket-why-cant-i-create-a-master-x-branch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!