Instructions for Coworkers

Straightforward manner to use git (more or less) privately.    #git #private #collab

In a previous post I explained how use git on your own server.1 Here, what follows is a brief guide for my coworkers on how to use git on my server, to avoid them having to read that lengthier previous explanation.

Step 1. Generate an SSH key—by running $ ssh-keygen -t rsa -b 4096—if you do not have one already. Either way, this will leave you with two files; send me the public part (the file that ends with .pub). In what follows I will assume that your private key is ~/.ssh/mykey and your public key is ~/.ssh/mykey.pub.

Step 2. On file ~/.ssh/config (create it if it does not exist), put (or append) the following block, separating it from other blocks with empty lines:

Host gitop
Hostname randomwalk.eu
Port 22
User git
IdentityFile ~/.ssh/mykey
IdentitiesOnly=yes

Replace ~/.ssh/mykey with the path of your private key. Also, “gitop” can be an arbitrary string—it is just an alias for Hostname.

Step 3. Say the URL of the project we are working on is randomwalk.eu:my-project.git. After I confirm that you have access, you should be able to clone it by issuing the command:

$ git clone gitop:my-project.git

Step 4. The clone step should have set my server as the remote origin, so you should also be able to do $ git push. And thus you should be all set!

April 8, 2022.