Git repository on your own serverΒΆ

Tags: django

Git often means github. Perfect choice for my open source projects. For a private repository, you need to pay, however. The company I work for pays for such a private account so that our Django sites (with the occasional password and customer data in it) can be on github without being open to the world.

For my private projects (like settings files or the Django book source I’m moving), storing them on my linux server is good enough. I don’t need the github interface for that.

Also for my own reference, here’s what I do. On the server I have a ~/git directory with my repositories in there. To create a new one:

cd ~/git
mkdir myproject
cd myproject
git init --bare

That --bare means only the actual git repository data is stored (“the .git directory”) and not an actual readable copy of the current version of the code. You can leave out --bare, but it saves a bit of space.

On my own laptop:

cd /tmp
git init myproject
cd myproject
echo "hurray" > README.rst
git add README.rst
git commit -m "Added readme"
git remote add origin ssh://myserver.example.org/~/git/myproject
git push origin master

Now I can check out a clean copy somewhere. I personally use checkoutmanager for that. Or you can do a manual:

git clone ssh://myserver.example.org/~/git/myproject

I’ve stuffed the commands into a script, of course. Which is... on github :-)

blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):