Set up git on remote server
From Birnam Designs Wiki
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.
- 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
-
- on REMOTE, make sure you have the git server in the .ssh/config
-
Host git -
HostName 11.22.33.44 -
User git -
Port 22
-
- on LOCAL, make sure you have REMOTE in the .ssh/config
-
Host remoteserver -
HostName 44.33.22.11 -
User david -
Port 22
-
- if you don't already have a public key, duplicate the first step on LOCAL
- if you don't already have your public key on the remote server, copy it
- ssh-copy-id remoteserver
- 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
- on LOCAL, edit LOCAL/$GITOSIS/gitosis.conf. The
-
[gitosis] -
[group remoteguys] -
members = david@remoteserver -
writable = remotegit
-
- add new files and commit gitosis
-
cd $GITOSIS -
git add . -
git commit -a -m 'added remoteserver access' -
git push
-
- 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
-