niedziela, 31 lipca 2011

git remote repository

Let's assume we have some external server that we want to use as main/backup repository and we have ssh access to this server. First thing is to create base repository on the server:

mkdir PROJECT.git
cd PROJECT.git
git init-db --bare

Then, on the client side:
cd PROJECT
git init

git remote add origin SERVER_PATH
git config branch.master.remote origin
git config branch.master.merge master

git add .
git commit -a -m 'initial commit'
git push origin master

The SERVER_PATH should be like: username@server.address.net:~/path_to_PROJECT.git

And we are done.