4

How do I settup Git as a Git server like GitHub, so I can create private repositories, etc.?

I have installed LAMP. It's up and running smoothly and also Git with GITWEB works perfect. The only thing I don't get is how to use it as a server for my private repositories.

How can I do this? It there a good tutorial, because I haven't found anything really usable yet..

closed as off-topic by Jivings Jul 7 '13 at 19:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

3

There's a book about called Pro Git, freely available and downloadable over the Internet. That book has the "Git on the Server" chapter, that explains in thorough details how to install Git in different configurations according to your needs.

  • You should answer with an explanation, not with a reference – GuySoft Jun 24 '13 at 14:51
  • 1
    @GuySoft please, read the question thoroughly next time. OP asked for a tutorial, and I gave him one. – lenik Jun 25 '13 at 2:06
  • Ok, my bad. I guess at least you can link to that chapter. – GuySoft Jun 25 '13 at 7:54
1

Setting up a Git server (multi-user)

Handle Git user

Install gitolite or gitosis

Allow web access

Install gitweb

Notes

I prefer gitolite.


Setting up a Git server (single-user)

Git user

Create Git user

  1. Create Git user
    • sudo useradd -m git
    • sudo passwd git
  2. Add your key to your Git user (from another machine)
    • ssh-copy-id -i /path/to/id.pub git@host

Lock down Git user

vim /etc/ssh/sshd_config

Match User git
#ChrootDirectory /home/git/  #Look into this and see if you want it enabled.
AllowTCPForwarding no
X11Forwarding no
PasswordAuthentication no

sudo service ssh restart

Create your Git repository

sudo su - git

mkdir /home/git/reponame.git

cd /home/git/reponame.git

git init --bare

Look into using Git hooks to push code to another location when updating (post-update).

Push to your new repository

git push git@host:reponame.git master

Not the answer you're looking for? Browse other questions tagged or ask your own question.