You are currently offline, so some features of this site may not work fully.

Your browser doesn’t support some of the latest CSS features used to build this site.

Read more about my usage of new CSS features.

Another reference for myself so I don’t have to trawl my memory banks (and the internet) every time I set up a new project.
Disclaimer - this is written from a Mac user’s perspective, I suck at Windows command line so it probably won’t be the same for Windows.

Getting going

When I start little personal projects or experiments, I tend to keep the source on GitHub as a way to collaborate and share code with others. This also keeps me on my toes as I have to commit code I don’t mind people seeing and it makes me keep my code bases up to date.

However there are always times when the code needs to be kept private - all freelance work and a couple of collaborative projects I’m contributing to under NDAs.

In these cases I use a VPS provided by Ginernet for €6 or 7 a month to store my code repos on.

Step one

Open Terminal - or iTerm2 if you’re a hipster - and SSH on to your server*. Or wherever.

ssh [email protected]

Make a directory for your project and go into it.

mkdir my-project.com.git && cd my-project.com.git

Initialise git in that directory.

git init
* Tristan’s article is good if you’ve not set up SSH keys before.

Step two

On your machine, make a directory for the project and go to it.

mkdir my-project.com && cd my-project.com

Initialise git in that directory.

git init

Add files in that directory then set up your first commit.

git add *
git commit -m "First commit with all the things"

Add the remote origin and push to it!

git remote add origin [email protected]:projects/my-project.com.git
git push -u origin master

Step-two-and-a-bit

When If it doesn’t work and seems to be throwing a permissions error, get back on to the remote server and check the user and group permissions for the directory you just created.

If the right permissions aren’t set, chown the directory as needed.

I always forget this and pull my hair out for a bit.

Step three

Relax. And start working.


TL;DR

How I set up a remote Git repository and start working away.