install git server on ubuntu

first create the pub key for current user
ssh-keygen
generated key is in /home/me/.ssh/id_rsa.pub
now copy it to /tmp
cp /home/me/.ssh/id_rsa.pub /tmp/me.pub

sudo apt-get install install git, git-daemon-run

create a new user “git”
sudo adduser \
–system \
–shell /bin/bash \
–gecos ‘git version control’ \
–group \
–disabled-password \
–home /home/git \
git

now as user git
sudo su git
git clone git://github.com/sitaramc/gitolite
mkdir -p $HOME/bin
gitolite/install -to $HOME/bin
$home/bin/gitolite setup -pk /tmp/me.pub
exit
now back to regular user “me”
cd $home
git clone git@ubuntu:gitolite-admin
cd gitolite-admin
cd conf
vi gitolite.conf
here you can add repository, change the allowed user
save the file
git add .
git commit -m ‘update conf’
git push origin master

to add a new user
cd /home/me/gitolite-admin/keys
vi jack.pub
copy/paste the public key
save
git add/commit/push

on windows can use sysgit
it can generate keys for you

on eclipse to use remote git server
first make sure to have the keys in c:/users/me/.ssh
(presumably id_rsa.pub)
add a file “config” in .ssh directory

Host ubuntu
HostName ubuntu
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa

(here ‘ubuntu’ is the host name of the remote server, you may add to the /windows/system32/driver/etc/host file)

or through
ecpise-> preferences -> networking -> ssh2

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s