How to Set Up a Personal Git Repository in 10 Minute
I’ve been looking at Google for some quick howto’s on how to setup a git repository on my home server. I’ve lost a couple of minutes reading the howto’s on-line and then a couple of hours trying to figure out what I was doing wrong. The entire process is plain simple and takes less then 1 minute if you know how git works. Most people who write the howto’s, probably don’t, because they don’t work. For instance, you can’t push/pull an empty repository with git. It complaints and comes out with an error. Then if you Google on the error you find any kind of possible blog post and forum post and you end up losing… time.
Enough whinny, here is how it works. I assume that you use ssh + keys for your server. If you don’t use ssh, you’re on your own. Google on how to create and use ssh keys and come back if you don’t know how to create rsa keys.
We will create the remote repository first.
1 2 3
We need the “–bare” flag. If you want to know why, read the manual and have in mind that this is a remote repository.
At this point we go on the desktop computer where the actual development will take place. I assume that you will use the same directory and project for the sake of coherence.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
You should be able to see the “Already up-to-date” flag also. Now on how to proceed from here, read the git tutorial. Apart from gitweb there several others solutions for viewing your repository online. The php-ones are the most easy to install and configure.
PHP Support for HTTP View of the Branch
Gitview is a simple php script that can take advance of Geshi, for syntax highlighting. Now if you just setup gitview it will use geshi, which must be manually installed and used. No big deal, just download geshi adjust the path in the config.php:
1 2 3 4
Then you just adjust the “index.php” file to use the specific language by changing this line:
Note that this is for Objective-C but Geshi supports an awful lot of languages. The problem with geshi is that it can’t understand _on the fly _which programming language you want to use, according to the developers the reason for this is:
1 2 3 4 5
Got them on Freenode. Mr (alias) BenBE gave me the correct syntax to put into that index.php file to make it work as it should. Thanks for the support!
You can find the development team of Geshi at Freenode channel “#Geshi”.
That’s all! :-)
If you get this kind of error:
1 2 3 4 5 6 7 8 9 10 11 12
Take a look here. Don’t panic it’s just a design “flaw” from overzealous developers!
For a more detailed howto with RoR support take a look here.