Set up git on remote server

From Birnam Designs Wiki

Jump to: navigation, search

This assumes that gitosis is set up. I will refer to local machine as LOCAL and remote as REMOTE, that LOCAL has full ssh access to REMOTE, and the gitosis directory as $GITOSIS. This will create the initial git repository on REMOTE.

  1. on REMOTE, create a key pair
    • ssh-keygen -t rsa -f ~/.ssh/id_rsa
    • this creates ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub -- the latter is the one you will need
  2. on REMOTE, make sure you have the git server in the .ssh/config
    • Host git
    • HostName 11.22.33.44
    • User git
    • Port 22
  3. on LOCAL, make sure you have REMOTE in the .ssh/config
    • Host remoteserver
    • HostName 44.33.22.11
    • User david
    • Port 22
  4. if you don't already have a public key, duplicate the first step on LOCAL
  5. if you don't already have your public key on the remote server, copy it
    • ssh-copy-id remoteserver
  6. copy the id_rsa file you generated on REMOTE to LOCAL -- rename to reflect the hostname and add .pub after it
    • scp remoteserver:.ssh/id_rsa.pub $GITOSIS/keydir/david@remoteserver.pub
  7. on LOCAL, edit LOCAL/$GITOSIS/gitosis.conf. The
    • [gitosis]
    • [group remoteguys]
    • members = david@remoteserver
    • writable = remotegit
  8. add new files and commit gitosis
    • cd $GITOSIS
    • git add .
    • git commit -a -m 'added remoteserver access'
    • git push
  9. then create the repository on REMOTE
    • git init
    • git add .
    • git commit -a -m 'initial commit'
    • git remote add origin git:remotegit
    • git push origin master
Share This!
This page was last modified on 31 March 2010, at 17:46. This page has been accessed 469 times.