开发者

How do I setup a private git repository in Ubuntu?

I use a git repository at work on GitHub. I know the basic commands for navigating and editing a repository but I don't know how to set one up from scratch.

I would like to setup my own server for the git repo so开发者_JAVA百科 my buddies can come help me with the game I'm developing for Android. But I don't know how!

Would Gitosis be the best choice for this?


IMO the simplest way is to use ssh. If you have a machine that you and your buddies can all ssh to, then you just make a bare clone of your repository, put it up on the ssh server, and clone it from there. I do this using my dreamhost account as the server.

cd my-repo
cd ..
# Make a bare copy of the repo
git clone --bare my-repo my-repo.git
# Upload the bare copy to the server
# -- in this case, I've already created a /repos folder to hold the bare repos
rsync my-repo.git/ mysshserver:/repos/my-repo.git/
# Add the new server repo as a remote to your local repository
cd my-repo
git remote add origin mysshserver:/repos/my-repo.git

Then for your buddies:

git clone mysshserver:/repos/my-repo.git/

The only trick is making sure all the user accounts you are using have write permissions to the repo folder (/repos/my-repo.git/* on the server).


First, You need to create the repo (easy as git init)
Second, You need to give your buddies access to the repo.

You may use few options which git handles:

  • via file:// (direct access on LAN)
  • via ftp
  • via git protocol (ssh access)

Third, manage the access, permissions etc.

For this, the best option is gitolite, better than gitosis. There is a good installation guide in the repo. The most tricky part is setting up passwordless access to the server (but this this is not actually git related). Using Ubuntu and Github you probably know what for are public ssh keys.

Gitolite is the best option so far, but a bit complex. However, if you don't want to use gitolite, you may still only to init the repo, and make the machine accessible, which is the simplest solution.

See also Setting Up the Server from the free Pro Git book. There are chapters about gitolite and gitosis as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜