Skip to content
mengfung.com
writing

Making a Remote Git Repo on Media Temple (DV)

 ·  1 min read

I’ll be using ssh and rsa certs.

ssh into your server using root.
Client:

ssh root@my-example.com

Server:
Add a user on the server

adduser git

Now you should have a /home/git directory
Inside that directory we will make a new repo and cd into it:

mkdir /home/git/newapp.git && cd /home/git/newapp.git
git --bare init
cd..
chown -R git:git /home/git/newapp.git

You now have a remote git repository. To create new repos just follow these steps without the adduser, unless you want to create users for each different repos. You might want to look into gitosis

Now generating ssh keys to connect the server and client instead of using a password.
Client:

ssh-keygen -t rsa
Enter file in which to save the key: [Return]
Enter passphrase (empty for no passphrase): [Return]
Enter same passphrase again: [Return]

This should create on your client computer a .ssh directory and to files: id_rsa and id_rsa.pub important to us. Mac location is “/User/[username]/.ssh”, Linux location is “/home/[username]/.ssh.
cd into that directory then:

vi /home/git/.ssh/authorized_keys