2012-06-19 41 views
1

我正在尝试建立工作流程来创建新项目,并设置旧版本的项目通过Git进行版本控制。除了一步之外,最终都是有道理的。当我创建一个新项目时,初始化Git并执行初始提交,然后执行git clone --bare ./myproject //myserver/myshare/myproject.git。然后我设置了一个遥控器,git remote add origin //myserver/myshare/myproject.git。这些似乎工作正常。但是,当我做git branch -a时,它没有显示远程存在主分支。git clone --bare不包含分支主文件

我现在正在解决这个问题的方法是,我只是git clone //myserver/myshare/myproject.git到一个不同的位置,并且远程已经建立,并且主分支存在于远程。我不知道有什么可能是错的,特别是因为唯一的区别似乎是遥控器设置的方式。

在此先感谢!

回答

2

没有错。从git clone手册页:

--bare 
     Make a bare GIT repository. That is, instead of creating <directory> and placing the administrative files in <directory>/.git, make the <directory> 
     itself the $GIT_DIR. This obviously implies the -n because there is nowhere to check out the working tree. Also the branch heads at the remote are 
     copied directly to corresponding local branch heads, without mapping them to refs/remotes/origin/. When this option is used, neither remote-tracking 
     branches nor the related configuration variables are created. 

裸存储库不映射master提交指针refs/remotes/origin/master,但他们没有。裸回购是vital when setting up remotes that others might push to or pull from,,但they aren't where you do day-to-day dev work.这听起来像你有一个origin。除非您正在设置另一个远程设备,否则请使用git clone //myserver/myshare/myproject.git作为本地存储库。

+0

你是说我现有的流程是正确的吗?我认为所有的合并和工作都应该在本地完成,但我希望// myserver成为每个人都可以推动和拉动变化的集中式回购,并且我希望我们有分层的分支(主人正在发布,然后是一个测试分支,在这个分支最终使它成为主宰之前集成了这些功能 - 这些分支可以从回购中获得)。感谢您的答复。 – Ethan

+0

是的,如果你想让'// myserver'成为每个人都可以'push'或'pull'的集中式回购,你应该设置得很好。如果你想在它上面放置新的分支,将它们分支到你的本地仓库并将它们推送到原点。例如。 'git结帐-B测试大师&& git推送原点测试' – Christopher

+0

听起来不错。再次感谢。 – Ethan