我曾经在我的私人git服务器上创建一个repo
git init --bare
Initialized empty Git repository in /home/poc/git_repo/local_display_multi_langs .git/
然后我尝试在我的Mac上的工作副本中add remote
。
git remote add origin ssh://poc@172.19.16.101/home/poc/git_repo/local_display_multi_langs.git
执行以下命令
514 git flow init
519 git flow feature start read_xml
524 git ci -am "first ci"
然后尝试将所有分支推送到我的私有git服务器的repo 并得到以下例外
[src] $ git push origin feature
poc@172.19.16.101's password:
error: src refspec feature does not match any.
error: failed to push some refs to 'ssh://poc@172.19.16.101/home/poc/git_repo/local_display_multi_langs.git'
我是否错过或误用了一些步骤?
如何将工作副本上的所有分支推送到远程服务器?
然后当我从我的git服务器克隆项目时。
如何获得新的克隆项目和原始项目是完全相同的。
感谢@VonC
现在我可以通过
将本地工作副本上的所有分支推送到远程服务器 git push origin --all
但是当我做git clone ssh://poc@172.19.16.101/home/poc/git_repo/local_display_multi_langs.git
在另一个文件夹下。
[local_display_multi_langs] $ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/develop
remotes/origin/feature/read_xml
remotes/origin/master
我看到上面的分支对我来说很奇怪。
因为我希望获得与原始工作副本相同的结果,如下所示。
有没有办法获得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
答案 0 :(得分:2)
如何将工作副本上的所有分支推送到远程服务器?
你至少可以做到:
git push origin --all
'feature
'是git-flow的命令,而不是分支的名称
请参阅gitflow cheatsheet。
'feature
'转换为分支名称空间,定义 branch hierarchy 。
仅推送那些功能分支将是:
git push origin refs/heads/feature/*:refs/remotes/origin/feature/*