Git has a built-in server for sharing git repositories. If you have several repositories in your working directory:

for eg:

Step-1 :- We clone the repo from Github

git clone git@github.com:vishnu/vishnu.git —> To our home directory for eg: /home/vishnu

step-2 :- git-deamon git daemon –base-path=/home/vishnu –export-all –enable=receive-pack (I created a supervisor to run this)

root@vishnu-machine:~# vim /etc/supervisor/conf.d/git_mirror_update.conf [program:git_mirror_update] command=/usr/local/bin/git daemon –base-path=/home/vishnu –export-all –enable=receive-pack process_name=%(program_name)s directory=/home/vishnu autostart=true autorestart=true stopsignal=QUIT redirect_stderr=true stdout_logfile=/var/log/supervisor/%(program_name)s.log stdout_logfile_maxbytes=1MB stdout_logfile_backups=5 stdout_capture_maxbytes=1MB

root@vishnu-machine:~# supervisorctl status git_mirror_update RUNNING pid 3041, uptime 8:18:46

step-3 :- then we create a mirror from the repo which we cloned to another location in our system

git clone git://127.0.0.1/vishnu

Step-4 :-

git clone –mirror git@github.com:vishnu/vishnu.git

Step-5 :-

cd vishnu.git

Step-6 :-

git push –mirror git://127.0.0.1/vishnu ——> This will update all the remote branches

In the deploy.rb, use

set :repository, “git://127.0.0.1/vishnu”

For refferel :- https://help.github.com/articles/working-when-github-goes-down