Tuesday, November 18, 2014

Adventures in Web Development: Grousing at Git



Abstract:

If you're in a situation where you want to use an IDE to work on a Git project hosted on an enterprise version of GitHub, EGit will save you a lot of headaches. 

The long version:

An exciting part of my new role is assisting my team adopt Git as our version control solution. I have very little experience with it and have been wanting to learn it for years. Everything I read and heard about it gave me the impression that it's an easy-to-use yet powerful tool (plus all of the cool kids use it). Why wouldn't I want to use it too?

My team is in the process of transitioning from a strictly server-side development environment to a hybrid of client-server development. To do this, we're setting up project directories on our dev server and mounting those directories on our workstations as extra drives using sshfs. This allows us to develop with IDEs and other tools while still being able to see our changes immediately.  Granted, vim and emacs have their charm but I'll take a GUI over memorizing cryptic shortcut commands any day.

A nice feature of most popular IDEs is integration with a version control system like Git. My current IDE of choice is Aptana (emphasis on current) since it's free and seems to have decent syntax support for web languages. Aptana comes with Portable Git which is a lightweight version of Git. I assumed this would be all I needed, but boy was I wrong.

When trying to clone a repository from GitHub enterprise, I got an error saying "Bad credentials". I was sure that I put in the right information so I was very confused.



I thought perhaps I had to point the URI to my repository for the validation test, but that didn't work. Then I tried alterations of my username, adding in the domain. No luck. The Git options in Aptana were less than helpful too. After some research, I came to the conclusion that Aptana's Git plugin just assumes that any repository you want to work with is on github.com. There appears to be no support for working with GitHub enterprise repositories.Very frustrating.

Next I tried GitHub's desktop client because a coworker got it to work in his OS X environment without a hitch. After I put in my information, I saw my repositories show up. This looked promising since the client was actually able to authenticate with the enterprise account. I selected one of my repositories in the "clone" menu and hit the go button. The transfer seemed to be working until the progress bar reach halfway and hit an error. I knew the client was able to reach my repository so I was doubly confused.



After failing with two GUIs, I figured that Portable Git's Bash wouldn't let me down. I tried cloning the repository onto my network dev directory using Git Bash. This actually worked, but trying to stage changes resulted in a similar credentials error.

At this point I knew my problem wasn't a random bug. I dug into the logs for each of these three situations and found a similar symptom: "insufficient permission for adding an object to repository database .git/objects". Answers on the Web said to change permissions on the objects directory to give my workstation user read/write access. The problem was that my user didn't have privileges to change that access. It seemed that I was at an impasse.

Then, I found out about the EGit plugin for Aptana and figured it wouldn't hurt to give it a shot. After installing it, I was surprised to see that I was able to clone a repository, make changes and push them to my remote repository flawlessly. If only I had tried it to begin with!

My coworker tweeted Aptana asking why enterprise repositories aren't supported and got the response "I would expect GitHub would provide support through the EGit plugin." This make me wonder why the EGit plugin is not included by default or at least clearly referenced in the help docs? This would have saved me a lot of wasted time.

Monday, November 10, 2014

Pondering a Pond



Having been in a new role for three weeks, I am starting to sorely miss being able to regularly enjoy a stroll through nature. For over two years, I had the privilege of working at an office that was right next to a park with a walking trail going around the pond pictured above. I used to have the pleasure of seeing views like that one every day. It was a refreshing escape from the stress that came from the day-to-day task juggling. With music flowing into my ears, walking that trail gave my mind some space to daydream.

Now I work in a basement office without windows, which is a bit of a shock. I can still take mental breaks outside when I need some fresh air, but now that the snow is flying, I won't be doing that for quite a while.

Leaving that trail feels like leaving a part of myself behind. To me it represented a place to breathe, think and explore. It was always there when I needed it and I never regretted taking a walk around it. I hope to find a similar place by my current place of work. The snow just started flying today, so it's going to be a long winter.