中心仓库如何建立分支問題

75 views
Skip to first unread message

addcn

unread,
Apr 10, 2012, 1:20:42 AM4/10/12
to Git中文用户组
服务器(192.168.1.20)已经建立好裸仓库为中心仓库,开发端(192.168.1.35)上clone后,pull/push操作也正常
但是如何在中心仓库建立两个分支呢?在服务器还是开发端操作建立?

我在开发端执行git push origin nonexists会报错:
error: src refspec nonexists does not match any.
error: failed to push some refs to 'ssh://192.168.1.20/home/git/
demo.git'

服务器执行git status等操作也提示错误:
fatal: This operation must be run in a work tree

见一个成功的模式http://nvie.com/posts/a-successful-git-branching-model/

AleiPhoenix (A.K.A Areverie)

unread,
Apr 10, 2012, 1:28:32 AM4/10/12
to git...@googlegroups.com
中心仓库建立2个分支的话,本地推上去就好了

git push origin branch_name

另,

git status命令只能在WD下运行,你使用的中心仓库应该是bare的吧

2012/4/10 addcn <lhu...@gmail.com>



--
Silence is gold.

twitter: @areverie
wikipedia: AleiPhoenix
blog: weblog.areverie.org
wiki: wiki.areverie.org


addcn

unread,
Apr 10, 2012, 1:42:44 AM4/10/12
to Git中文用户组
中心仓库建立2个分支的话,本地推上去就好了

报错了,求解......錯誤信息如下:


error: src refspec nonexists does not match any.
error: failed to push some refs to 'ssh://192.168.1.20/home/git/
demo.git'


On 4月10日, 下午1时28分, "AleiPhoenix (A.K.A Areverie)"

Peter

unread,
Apr 10, 2012, 3:09:02 AM4/10/12
to git...@googlegroups.com

http://help.github.com/remotes/

Pushing a branch

To push a local branch to an established remote, you simply need to use git push REMOTENAME BRANCHNAME If you don’t want to use the same name on the remote branch you can use git push REMOTENAME LOCALBRANCHNAME:REMOTEBRANCHNAME.


有时 google  是最好的老师 :)

2012/4/10 addcn <lhu...@gmail.com>

addcn

unread,
Apr 10, 2012, 5:08:43 AM4/10/12
to Git中文用户组
感谢各位,此问题已解决了

总结一下(以下命令在开发端操作):

建立远程分支
git push origin develop

显示远程信息
git remote show origin

关于远程分支管理,推荐这篇文章
http://progit.org/book/zh/ch3-5.html

Reply all
Reply to author
Forward
0 new messages