github像私人服务器上的工作流程ssh
我有一台服务器(通过ssh)在互联网上,我的朋友和我一起使用的项目。我们已经开始使用git进行源代码管理。我们的设置目前如下:github像私人服务器上的工作流程ssh
- 朋友创建存储库上
server
与git --bare init
命名project.friend.git
- 我使用
git clone [email protected]:/git_repos/project.jesse.git
- 上
server
克隆project.friend.git
到project.jesse.git
- 然后我就
server
克隆project.jesse.git
到我的本地机器我在本地机器上工作并提交给本地机器。当我想将我的更改推送到时,我使用git push origin master
。我的朋友正在研究project.friend.git
。当我想要得到他的改变时,我做了pull [email protected]:/git_repos/project.friend.git
。
似乎一切都做工精细,不过,我现在得到以下错误,当我做git push origin master
:
localpc:project.jesse jesse$ git push origin master
Counting objects: 100, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (76/76), done.
Writing objects: 100% (76/76), 15.98 KiB, done.
Total 76 (delta 50), reused 0 (delta 0)
warning: updating the current branch
warning: Updating the currently checked out branch may cause confusion,
warning: as the index and work tree do not reflect changes that are in HEAD.
warning: As a result, you may see the changes you just pushed into it
warning: reverted when you run 'git diff' over there, and you may want
warning: to run 'git reset --hard' before starting to work to recover.
warning:
warning: You can set 'receive.denyCurrentBranch' configuration variable to
warning: 'refuse' in the remote repository to forbid pushing into its
warning: current branch.
warning: To allow pushing into the current branch, you can set it to 'ignore';
warning: but this is not recommended unless you arranged to update its work
warning: tree to match what you pushed in some other way.
warning:
warning: To squelch this message, you can set it to 'warn'.
warning:
warning: Note that the default will change in a future version of git
warning: to refuse updating the current branch unless you have the
warning: configuration variable set to either 'ignore' or 'warn'.
To [email protected]:/git_repos/project.jesse.git
c455cb7..e9ec677 master -> master
这是警告什么我需要担心什么?就像我说的,一切似乎都在起作用。我的朋友能够从我的分支中提取我的更改。我有服务器上的克隆,所以他可以访问它,因为他无法访问我的本地计算机。有什么可以做得更好吗?
谢谢!
您应该在服务器上设置一个裸露的存储库。裸存储库仅包含版本历史记录信息,通常位于存储库根目录的.git
目录中。你可以从它克隆或推送到任何其他存储库一样。
裸仓库与
git init --bare
创建如果你已经有一定的历史版本进行裸克隆
git clone --bare git://some/where
至于你的警告看到this question。
我的不好...当我创建第一个仓库时,我曾经使用过git init --bare。链接为+1。 – 2010-04-30 03:53:32
当我克隆存储库时,我一直缺少的是--bare。谢谢! – 2010-04-30 12:59:51
你确定你的'master'指向'project.jesse.git'吗? – 2010-04-30 03:57:34
@matt b,因为我发给主人的改变不会出现在project.friend.git中,直到他把他们拉进自己为止。 – 2010-04-30 04:07:15