I've recently set up ubuntu-server on Amazon EC2. I would like to use it as my git server, so I could store my repos there.
So, where can I find some detailed instructions of how to setup git on ubuntu server? All these SSH keys and stuff like that, multiple users, etc.
You can use the tutorial to install a Git server as aking1012 proposed you or you could just install SSH server on your EC2 instance (probably it would be wise to secure it and change the default port).
Git can be server-less you init your repository and then you access it from remote via SSH. So instructions like this on the Ubuntu Server should do it:
Finally install SSH on your server:
Now, you should configure SSH to secure it.
It's time to put your project online (the data you already have on your development machine):
And now you can start cloning around. You go on your development machine:
Check this excellent resource on Git.
And for generating your ssh keys for safer authentication, you can read this article about SSH authentication.
For all my Git server setups I use Gitolite which allows for a security granularity of "per-branch" access. Setup is pretty straight forward if you're doing it on a remote server it's as easy as running an interactive script. In addition to this "easy-to-setup" nature it also has a package in Natty and Maverick
This won't provide a web frontend like Github, or Gitweb - but you can easily configure and install those on top of something like Gitolite.
I like gitolite. The Pro Git book has a section on it but I recommend reading the whole book.
As for your multiple users requirement:
http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way can be slightly modified to suit your purposes...a similar tutorial http://blog.agdunn.net/?p=277.
Definitely follow the official documentation: https://help.ubuntu.com/community/Git (section Setting up Git and Project Management)
The solution that worked the best for me, was setting up WebDAV.
sudo a2enmod sudo dav_fs
sudo a2enmod dav
add new file to
/etc/apache2/sites-available
and name it, for example,git.yourserver.com
. Edit it and add following lines:<VirtualHost *:80>
</VirtualHost>
/var/www/git.yourserver.com
and directoryrepos
inside idsudo chown www-data /var/www/git.yourserver.com/repos
sudo htpasswd -c /var/www/git.yourserver.com/password.dav user_login
and enter password for user nameduser_login
sudo chown root:www-data /var/www/git.yourserver.com/password.dav
sudo chmod 640 /var/www/git.yourserver.com/password.dav
Now,
sudo a2ensite git.yourserver.com
andsudo service apache2 restart
./var/www/git.yourserver.com/repos
and create directory, for example,myrepo.git
cd myrepo.git
git --bare init
git update-server-info
Now, logout from your remote server and go to local directory you want to edit your files in.
and you've finished. If you want to send your commited changes to the server:
You can create as many users as you want using
sudo htpasswd
. Just remember not to use-c
switch, when adding more users, because old file will be deleted.It is very easy to achieve with gitolite. In less than an hour you will have easy configurable and secure multiuser git server.
I have an howto article on my site
I also like the gitolite approach for managing users and security. I have a Git + gitolite server AMI for EC2 currently being tested. Feel free to give it a try; documentation is available here:
Using this approach, you can have a central Git server with private repositories running in a matter of minutes. There is a learning curve for gitolite and EC2 if you aren't familiar with them.