内部存储库设置 [英] Internal Repository Setup
问题描述
最近我跳上了GIT潮流.我对使用哪个DVCS主机感到困惑.我的想法是可以在专用/vps服务器上设置自己的东西.
I have jumped on the GIT bandwagon lately. I am confused about which DVCS hosting to use. I am in a notion that i can setup my own thing on a dedicated/vps server.
所以,我的问题是,如何在我拥有的专用服务器上设置自己的内部远程存储库管理系统?
So, my question is that, how to setup my own internal remote repository management system on the dedicated server that i have?
请指导.
致谢
推荐答案
在服务器上,在要使用的目录中运行以下命令...
On the server run the following command in a directory you want to use...
git init --bare
这将在服务器上创建一个空/裸存储库.
This creates an empty/bare repository on the server.
在客户端上,在现有的git存储库中运行以下命令(假设您知道如何执行此操作)...
On the client run the following command in an existing git repository (assume you know how to do this)...
git remote add myserver <url/path>
这会将远程/链接添加到您的服务器.路径可以是本地,远程(http,ssh等).
This adds a remote / link to your server. Path can be local, remote (http, ssh, etc).
- 在本地文件系统上,使用:〜/myrepo/example.git
- 使用ssh:ssh://username@example.org/~/myrepo/example.git
- 使用http: http://username@example.org/myrepo/example.git
有关通过ssh设置git的更多信息,请参见以下文章.
For more info on setting up git over ssh see the following article.
要将代码推送到您的服务器,请执行以下操作...
To push code to your server do the following...
git push myserver master
这会将您的提交推送到远程服务器.其中"myserver"是您赋予远程位置的别名
This pushes your commits up to the remote server. Where 'myserver' is the alias you gave to your remote location
git pull myserver master
使用git pull,您可以从服务器下载/拉取所有提交.
With git pull you download/pull all the commits from the server.
编辑 Github很棒,还具有许多其他功能,但是很高兴知道如何自己设置git存储库.
Edit Github is great and has a lot of additional features, but it is good to know how to set up a git repository yourself.
这篇关于内部存储库设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!