Git + Google Code + Windows

Just a quick one here because I’m hoping it will benefit a person or two. I’d like to start by stating I’ve always been a Windows user. I don’t like using Macs and I don’t like using *nix. Why? It’s just my preference, and I’ll leave it at that (I don’t have an emotional attachment to Microsoft or anything, I’m just well versed with Windows). Anyway… I was recently trying to get a Google Code page setup for one of the postings I wrote. However, being a Windows user made things pretty difficult. Here’s how I solved my problem:

  • Install GitExtensions (I already had this installed, because I use this for everything)
  • Created my google code account and created my project.
  • Changed my google code account permissions to allow my GMail credentials when pushing. You can do that here.
  • Navigate to this page (well, the equivalent for your project), which gives you a nice address for cloning:
    git clone https://your-user-name@code.google.com/p/your-project-name/
  • Use git extensions to clone this repo somewhere. If you just made your project, it’ll be empty! Makes sense.
  • Add all the stuff you need to, and then make your first commit.
  • Push up your code! But…
  • —-Here is where it all broke down—-
Okay, so I can’t push up code because my remote isn’t setup properly now. Something to the tune of:

“C:Program Files (x86)Gitbingit.exe” push –recurse-submodules=check –progress “origin” master:master
error: The requested URL returned error: 500 while accessing https://[email protected]/p/event-handler-example/info/refs?service=git-receive-pack
fatal: HTTP request failed
Done

But why?! I’m pushing to origin! Well, that’s exactly why. ‘origin’ in my case refers to the repository I have on a different server–NOT where google code is! What did I do next then? Googled like mad until I got to here. Thank you StackOverflow, yet again.
Next steps:
  • From git extensions, launch the bash window. And yes, believe me… I get super nervous as soon as I have to use the console I’m unfamiliar with.
  • Next, I used these two beautiful commands:
$ git remote add googlecode https://project.googlecode.com/git
$ git push googlecode master:master
  • I had to enter my credentials next… But that’s easy.
  • And the rest is history! The two commands simply added a “remote” called googlecode and then pushed my branch up to the googlecode remote.

It was actually an extremely simple solution, I just wasn’t paying attention to what exactly was wrong. I figured by cloning the repo initially it knew where the correct remote was. Unfortunately, that’s not the case.

author avatar
Nick Cosentino Principal Software Engineering Manager
Principal Software Engineering Manager at Microsoft. Views are my own.

Leave a Reply