Farid Ahmadian / DevOps

GIT


Gitosis setup server


git clone https://github.com/tv42/gitosis.git
cd gitosis
python setup.py install
adduser     --system     --shell /bin/sh     --gecos 'Git'     --group     --disabled-password     --home /home/git     git
apt-get install sudo
sudo -H -u git gitosis-init < ~/.ssh/authorized_keys
chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

Gitosis repositories management


git clone ssh://[email protected]{git server ip}:{git server port}/gitosis-admin.git
cd gitosis-admin
ls keydir
vi gitosis.conf
git commit -a -m "Create repository for  ....."
git push origin master

Gitosis project initialization


git init
git remote add origin ssh://[email protected]{git server ip}:{git server port}/{repo name}.git
git add .
git commit -a -m "initial"
git push origin master

Gitolite


Gitolite: Hosting git repositories — Gitolite allows you to setup git hosting on a central server, with very fine-grained access control and many (many!) more powerful features. installing Gitolite(Debian):

step 1:

execute command

@server: apt-get install gitolite

step 2:

scp administrator public-key

@local_pc: scp public_rsa.pub [email protected]:/admin.pub

step 3:

configure gitolite package

@server: dpkg-reconfigure gitolite

if asked for administrator ssh key type: /admin.pub else continue on with your own configurations

step 4 (optional to add users) :

@local_pc: scp user1_public_rsa.pub [email protected]:/user_1.pub
@local_pc: scp user2_public_rsa.pub [email protected]:/user_2.pub
@server: gl-setup /user_1.pub
@server: gl-setup /user_2.pub

step 5:

clone gitolite-admin repo

@local_pc: git clone ssh://{gitolite username}@your.server.address:/gitolite-admin

GitLab


gitlab.rb

external_url 'http://git.zanjanhost.ir/'
gitlab_rails['gitlab_email_from'] = '[email protected]'
gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
gitlab_rails['gitlab_shell_ssh_port'] = 1394
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587 
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "PASSWORD"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = :login
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
postgresql['max_connections'] = 20

gitlab management

gitlab-ctl reconfigure
gitlab-ctl restart
gitlab-ctl status
gitlab-ctl stop
gitlab-ctl start
gitlab-ctl status
gitlab-ctl tail

BY: Farid Ahmadian
TAG: git, gitosis, gitolite, gitlab
DATE: 2015-04-27 19:36:53


Farid Ahmadian / DevOps [ TXT ]

With many thanks and best wishes for dear Pejman Moghadam, someone who taught me alot in linux and life :)