simple git backup server

Simple git Backup Server Notes


Install git on the server
# apt-get install git-core

Create a 'bare' repository on the storage server
$ cd ~
$ mkdir test
$ git init --bare test
Bare are repositories without a working directory, suitable for storage.


Generate public and private key pair and copy the public key to the server
$ ssh-keygen -t rsa
$ ssh-copy-id user@server

Create a local repository and push it to the storage server
$ mkdir test
$ cd test
$ echo hi > test.txt
$ git init
$ git add test.txt
$ git commit -m 'first-commit-message'
$ git remote add origin ssh://user@server:/home/user/test
$ git push origin master

Simple git backup Server