Setting up a personal remote git repository

Even if Forum Nokia gives public git repositories for free, in some cases coders want to keep their work in a “more secret” place. So I set up a git remote repository on my home server.

Here are the steps I followed to have it in place:

On the server side:

1. apt-get install apache2 git-core gitweb

2. mkdir  /var/cache/git

Now we can create our first remote repository:

1. cd /var/cache/git/repository-name.git

2. git –bare init

3. chown your _ssh_username /var/cache/git/repository-name.git -R

4. chgrp your _ssh_username /var/cache/git/repository-name.git -R

So we have initialized an empty git repository  and we are now ready to use it!

On your local machine:

1.  git clone ssh://your_ssh_username@remote_server/var/cache/git/repository-name.git

2. cd repository-name

Let’s now try to do a simple basic operation, like adding a file to the repository

1. touch HELLO

2. git add HELLO

3. git commit -a -m “Add HELLO”

4. git push origin master

Moreover, since we installed gitweb, it shows our commits. Gitweb is available at  http://remote_server/gitweb

One comment on “Setting up a personal remote git repository

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.