April 17, 2012

326 words 2 mins read

Setting up a new GitHub repo in TortoiseGit

By now you’ve come around to accept that Git Is The Answer. You are a smart cookie and you’ve realized that GitHub Is The Answer (to Git). So you start creating GitHub repos for anything and everything (like me). It’s easy to create a new Git repo under Linux because GitHub tells you how. It’s also super easy to do so on Mac because you’ve got the GitHub client for OSX. But what if you’re on Windows? What if you’re on Windows and you use TortoiseGit? It’s easy, and I’ve got instructions!

First, for reference, here’s the “standard” (read: Linux) directions:

  • mkdir REPONAME

  • cd REPONAME

  • git init

  • touch README

  • git add README

  • git commit -m ‘first commit’

  • git remote add origin [email protected]:ORGANIZATION/REPONAME.git

  • git push -u origin master

What follows are the step-by-step instructions for using TortoiseGit in the same process. While this looks much longer (and harder), it’s not. I simply listed every single button press here so you wouldn’t miss a thing. After you’ve done this once, it won’t take more than a minute to setup your next new repo. Please note: I’ve swapped the origin URL for https since SSH keys (and all that jazz) aren’t quite as pleasant to deal with in Windows (plus HTTPS is awesome)

  • Create a directory

  • Right Click on directory

  • “Git Create Repository Here”

  • Leave “Make it bare” unchecked, Click OK

  • Right Click on directory

  • TortiseGit

  • Settings

  • Find the “Git” section

  • Fill in your “Name” and “Email”

  • Under “Git” select “Remote”

  • “Remote” is ‘origin’

  • URL is ‘https://[email protected]/ORGANIZATION/REPONAME.git'

  • “Add New/Save”

  • OK

  • Create your README file

  • Use TortoiseGit to Add READEME file

  • “Commit”

  • Fill in your commit message, e.g. ‘First commit’

  • OK

  • “Push”

  • Enter your password! The above only applies, in case it isn’t clear, if you’re making NEW repos under Windows/TortoiseGit. If you’re using TortoiseGit and checking out an already created Git repo, then you don’t need to worry about any of this. Just pull down the code and go.