在git中的远程存储库上创建一个新分支
正如标题所示,我正在尝试在远程存储库上的 git 中创建一个新分支。
为此,我之前一直使用以下命令。
git push origin origin:refs/heads/rounding_issue
这通常可以正常工作,然后我可以运行
git branch -r
来确认。
然而今天早上这不起作用,我收到了以下错误消息。
error: src refspec origin does not match any.
error: failed to push some refs to '{user}@{location}:{repository}.git'
我用谷歌搜索了该消息并检查了各个网站,人们提出的唯一解释(我发现)是,也许主分支需要先推送,或者您需要先提交一些东西,我已经尝试过主机不同的事情,但每次错误消息都是相同的。
我可以很好地提交到 master 分支。
任何帮助将不胜感激。
As the title says I am trying to create a new branch in git on the remote repository.
To do this I have previously been using the following command.
git push origin origin:refs/heads/rounding_issue
Which normally just works and I can then run
git branch -r
To confirm.
This morning however this is not working and I have received the following error messages.
error: src refspec origin does not match any.
error: failed to push some refs to '{user}@{location}:{repository}.git'
I have googled the message and checked various sites and the only explanation people have been coming up with (that I have found) is that maybe the master branch needs pushed first or there are some things you need to commit first, I have tried a host of different things but each time the error message is the same.
I can commit to the master branch fine.
Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
git Push origin HEAD:refs/heads/rounding_issue
有效吗?您可以将“HEAD”更改为本地存储库中的其他提交,如“master”或“rounding_issue”(如果您本地有该分支)或直接 SHA-1 编号。
git push origin HEAD:refs/heads/rounding_issue
Works?You can change "HEAD" with some other commit in your local repository, as "master" or "rounding_issue" (if you have that branch locally) or direct SHA-1 number.
仅此而已
only that
如果您收到错误,表明您当前无权访问远程存储库。您可能还没有设置。当您在本地创建新分支,但忘记在远程启动它时,通常会发生这种情况。
git 远程-v
这将检查您当前的分支是否已连接到远程存储库。
如果不是,那么您必须使用此命令在远程设备上设置新分支。
完成此操作后,您可以使用此命令将新分支推送到远程。
希望这有帮助。
约翰
If you are getting an error that states that you currently do not have access to the remote repositories. Chances are that you probably haven't set one up yet. This often happens when you create a new branch on your local, but forget to initiate it on the Remote.
git remote -v
this will check for you if the current branch you are is connected to a remote repository.
If it isn't, then you have to set up the new branch on the remote with this command.
Once you have done that then you can push the new branch to the remote by using this command.
Hope this helps.
John