git push 错误“错误:src refspec xxx 不匹配任何。” 使用 git 流
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20393475/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git push error "error: src refspec xxx does not match any." using git flow
提问by newBike
I used to create an repo on my private git server
我曾经在我的私人 git 服务器上创建一个 repo
git init --bare
Initialized empty Git repository in /home/poc/git_repo/local_display_multi_langs .git/
Then I tried to add remote
in my working copy on my mac.
然后我尝试add remote
在我的 mac 上的工作副本中。
git remote add origin ssh://[email protected]/home/poc/git_repo/local_display_multi_langs.git
Executed the following commands
执行了以下命令
514 git flow init
519 git flow feature start read_xml
524 git ci -am "first ci"
Then tried to push all branches to my private git server's repo and got the exceptions as following
然后尝试将所有分支推送到我的私有 git 服务器的 repo 并得到如下异常
[src] $ git push origin feature
[email protected]'s password:
error: src refspec feature does not match any.
error: failed to push some refs to 'ssh://[email protected]/home/poc/git_repo/local_display_multi_langs.git'
Did I miss or misuse some steps ?
我是否遗漏或误用了某些步骤?
How to push all the branches on my working copy to remote server ?
如何将我的工作副本上的所有分支推送到远程服务器?
Then When I clone the project from my git server.
然后当我从我的 git 服务器克隆项目时。
How to get the new cloned project and original project are identical.
如何获取新的克隆项目和原始项目是相同的。
Thanks
谢谢
Thanks for @VonC
感谢@VonC
Now I can push all the branches on my local working copy to remote server by
现在我可以通过以下方式将本地工作副本上的所有分支推送到远程服务器
git push origin --all
git push origin --all
But When I do git clone ssh://[email protected]/home/poc/git_repo/local_display_multi_langs.git
under another folder.
但是当我ssh://[email protected]/home/poc/git_repo/local_display_multi_langs.git
在另一个文件夹下执行 git clone 时。
[local_display_multi_langs] $ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/develop
remotes/origin/feature/read_xml
remotes/origin/master
I saw the above branches which are strange to me.
我看到了以上对我来说很陌生的分支。
Because I expect get the same results as the original working copy like the following.
因为我希望得到与原始工作副本相同的结果,如下所示。
Is there any way to get clone from my remote server and restore the status as the original working copy
有什么办法可以得到 clone from my remote server and restore the status as the original working copy
[local_display_multi_langs] $ git br
develop
* feature/read_xml
master
采纳答案by VonC
How could I push all the branched on my working copy to remote server ?
如何将工作副本上的所有分支推送到远程服务器?
You can do at least a:
你至少可以做一个:
git push origin --all
'feature
' is a command of git-flow, not the name of a branch.
See gitflow cheatsheet.
' feature
' 是 git-flow 的命令,而不是分支的名称。
请参阅gitflow 备忘单。
'feature
' translate into a branch namespace, defining a branch hierarchy.
Pushing only those feature branches would be:
' feature
' 转换为分支命名空间,定义分支层次结构。
仅推送那些功能分支将是:
git push origin refs/heads/feature/*:refs/remotes/origin/feature/*
Or you can register the refspec in a .gitconfig.
或者您可以在 .gitconfig 中注册 refspec。