- I started using Unfuddle for [redacted]
- I like it so far.
- it’s a good service
- I’m going to move all my private repos there
- if you just want online repo storage, why not just use your Slice?
- I should do that
- It’s super easy
- you should blog it
So here is how to get your remote git up and go
Setting up a remote Git repo and connecting via ssh in a nutshell:
First, we install git on the server. I’m using aptitude on Ubuntu for this. Next, we have two options: we can just set up a bare git repo and push to it using an existing user; or, if we want to be able to safely share the repo with others, we can set up a git user. After setting up the git user, we create the bare git repo, chown it to the git user, and push to it from our local machine.
On your slice…
sudo aptitude git-core
Add the Git User (If you want to use an existing user, skip to step #7.)
sudo adduser git
Set up ssh key (standard procedure)
su - git mkdir .ssh chmod 700 .ssh nano -w ~/.ssh/authorized_keys
(Yes, I use nano. What of it?)
[ paste in public key and save the file ]
Give the Git User a special shell that only allows git commands
sudo nano /etc/passwd
[ Change git’s shell from
[ Save /etc/passwd ]
If you have set up your sshd_config to only allow specific users, you’ll need to add git
sudo nano /etc/ssh/sshd_config
[ Add git to AllowUsers (near the end of the file), e.g.: AllowUsers jason git ]
sudo /etc/init.d/ssh reload
Create a dir for your repos
sudo mkdir /var/git
sudo chown `whoami` /var/git
Create your first bare repo (
--baremeans no working dir; i.e. just the contents of .git)
cd /var/git mkdir test.git cd test.git git --bare init sudo chown -R git .
Back on your local machine…
Go to there
Add your remote (just as if it were somewhere like Github)
git remote add origin ssh://email@example.com/var/git/test.git
Push all your branches
git push --all
- If you use something other than Ubuntu and aptitude, your git-shell may be located somewhere else. Try which git-shell to find it.
- If you’ve changed your ssh port to something other than 22, you’ll need to do something like this: git remote add origin ssh://firstname.lastname@example.org:8822/var/git/test.git
- To allow others to contribute, put their public key in
/home/git/.ssh/authorized_keys, but remember, you can’t log in as git; so, you’ll need to edit it as root with sudo.
Questions? Comments? Recommendations? Let me know.