We can build git server using gitolite which also we can host into our Ubuntu. First, we wil act as client which need SSH public keys. Generate our ssh public keys and copy into /tmp by :
1 2 | ssh-keygen -t rsa cp ~/.ssh/id_rsa.pub /tmp/local.pub |
Now, we should install dependencies packages by :
1 | sudo apt-get install git gitolite git-daemon-run |
Then, we can setup our global git configuration by :
1 2 | git config –global user.name "Your Name" git config –global user.email your@email.com |
Then we need to create git user by :
1 2 3 4 5 6 7 8 | sudo adduser –system –shell /bin/bash –gecos ‘git version control’ –group –disabled-password –home /home/git git |
Then we login into git user :
1 2 3 | sudo su git echo "PATH=$HOME/bin:$PATH" > ~/.bashrc gl-setup /tmp/local.pub |
Just save it by “:wq” (VIM). Now you should exit and try to clone git-admin using your default user account (not git).
1 | git clone git@ubuntu:gitolite-admin.git |
Create new repository by editing “gitolite-admin/conf/gitolite.conf”, eg :
1 2 3 4 5 | repo gitolite-admin RW+ = @all repo insurances RW+ = @all |
Then you can try to commit this repo :
1 2 3 | git add -A git commit -m ‘create new repo’ git push origin master |
Then you can clone new repo by :
1 | git clone git@<your-hostname>:insurances |
It easy to host git server into your PC with gitolite and Ubuntu 😀