Joe Maller.com

How to install Git on a shared host

(regularly updated)

Installing Git on a shared hosting account is simple, the installation is fast and like most things Git, it just works.

This is a basic install without documentation. My main goal is to be able to push changes from remote repositories into the hosted repository, which also serves as the source directory of the live website. Like this.

Prerequisites

The only two things you absolutely must have are shell access to the account and permission to use GCC on the server. Check both with the following command:

$ ssh joe@webserver 'gcc --version'
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
[...]

If GCC replies with a version number, you should be able to install Git. SSH into your server and let’s get started!

If you see something like /usr/bin/gcc: Permission denied you don’t have access to the GCC compiler and will not be able to build the Git binaries from source. Find another hosting company.

Update your $PATH

None of this will work if you don’t update the $PATH environment variable. In most cases, this is set in .bashrc. Using .bashrc instead of .bash_profile updates $PATH for interactive and non-interactive sessions–which is necessary for remote Git commands. Edit .bashrc and add the following line:

export PATH=$HOME/bin:$PATH

Be sure ‘~/bin’ is at the beginning since $PATH is searched from left to right; to execute local binaries first, their location has to appear first. Depending on your server’s configuration there could be a lot of other stuff in there, including duplicates.

Double-check this by sourcing the file and echoing $PATH:

$ source ~/.bashrc
$ echo $PATH
/home/joe/bin:/usr/local/bin:/bin:/usr/bin

Verify that the remote path was updated by sending a remote command like this (from another connection):

$ ssh joe@webserver 'echo $PATH'
/home/joe/bin:/usr/local/bin:/bin:/usr/bin

Note: Previous iterations of this page installed into the ~/opt directory. Following current Git conventions, I’m now installing into the default ~/bin.

Installing Git

SSH into your webserver. I created a source directory to hold the files and make cleanup easier:

$ cd 
$ mkdir src
$ cd src

Grab the most recent source tarball from Github. When this post was updated, the current Git release was version 1.7.10.1:

$ curl -LO https://github.com/git/git/tarball/v1.7.10.1

Untar the archive and cd into the new directory:

$ tar -xzvf v1.7.10.1
$ cd git-git-9dfad1a

By default, Git installs into ~/bin which is perfect for shared hosting. Earlier versions required adding a prefix to the configure script (like this), but none of that is necessary anymore. If you do need to change the install location of Git, just specify a prefix to the Make command as described in Git’s INSTALL file.

With all that taken care of, installation is simple:

$ make
$ make install
[lots of words...]

That should be it, check your installed version like this:

$ git --version
git version 1.7.10.1

It’s now safe to delete the src folder containing the downloaded tarball and source files.

My preferred shared hosting providers are A2 Hosting and WebFaction.


Twitter Reloaded UserScript

Due to excessive downtime and API rate limiting by Twitter, I’ve been experimenting a bit with using Fluid to run Twitter in a Site Specific Browser (SSB). While I’d much rather be using Twitterific or Hahlo, this works pretty well, except I had no luck with any Twitter auto-reloading UserScripts I found. So, as usual, I wrote my own.

The script was uploaded to UserScripts.org, you can install it and view source over there: Twitter Reloaded on UserScripts.org

The script does a few things differently from other scripts I found:

  • Reloading is postponed if there is any text in the status field
  • A visual countdown is inserted into the top of the page
  • Twitter pages are reloaded every two minutes, that’s probably still gratuitous, but every minute seemed like overkill.

Switching to Git

I resisted Git for a long time. It seemed a cultish thing with devout vocal followers and frequent mentions on Digg. I figured it would probably be a passing fad. I was wrong.

I drank the Kool-Aid and damn, it was tasty.

The first important thing to realize, especially when starting out and considering switching, is that Git works with existing Subversion repositories. That means the transition can be as simple as learning a few new commands, your repositories and servers don’t need to changing. Other team members don’t need to switch. If I had any other team members, this would be huge.

Of course, once you start using Git and see its potential, you’ll probably switch everything, convert your repositories and feel superior whenever you have to work with a Subversion hosted project.

Ultimately, Git is a revision control system and is fundamentally about preserving and protecting your working history. So feel free to experiment, it’s really hard to mess up.

It took me an afternoon to grasp the basic concepts of Git, or at least enough to use it in dumb-SVN mode. After about a week, I started to feel fairly comfortable.

I read a small mountain of weblog posts, documentation and the like, here are the ones I found most valuable:

And definitely watch Linus Torvalds’ Google talk about Git. It won’t tell you how to use Git, but he’s funny and the talk worth seeing.

Getting Git

While Git itself is easy to compile from source, getting the documentation manpages built on Mac OS X Leopard is a pain in the butt. I futzed around with it a little, but gave up halfway through installing a seemingly endless line of dependencies. The Mac binary installer works perfectly well and is kept up to date. I’d rather spend my time using Git than installing it.

Using Git

I was blown away by some of the stuff Git can do.

In the Google talk Linus pointed out how all SCM packages could do branching and branching wasn’t a problem. Merging was. Merging branches with Git is leprechauns and unicorns. It’s almost too easy. After a few days I found myself branching all over the place, constantly creating new branches to test any idea I was having. Folding those branches back in was almost always quick and painless.

Interactive line-by-line commits mean it’s possible to commit single lines from a file instead of the whole thing. This is great if you happen to go off on a bender and change a zillion different things between commits.

Cherry-picking is also great, and saved my butt when I created a pretzel of branch history. Using git-cherry-pick I was able to straighten out my history completely within Git using Git’s tools with no loss of work.

Conclusion

I started writing this post at the end of May, it’s now early July and I’ve been using Git for a few months with no regrets. The only time I hold my breath is when I’m pushing changes back to SVN, though it hasn’t glitched on me since early June. The speed and flexibility of Git are a constant pleasure to work with. The pain of merging branches, which used to take entire afternoons with SVN, has almost become an afterthought.


WWDC 08 wrapup

WWDC 08 was incredible. While the iPhone gold rush euphoria contributed, everything just seemed especially good this year.

I’ve been quietly disappointed in Leopard since it shipped. It just seemed too rough around the edges and somewhat rushed, especially compared to the polish demonstrated by the iPhoneOS. Because of that, I’m probably more excited about Snow Leopard than I was about Leopard. Besides the promise of generally improving the overall experience, the under-the-hood OpenCL and “Grand Central” additions are truly revolutionary advances for desktop OSs. The idea behind OpenCL being able to utilize the largely untapped parallel processing power of the GPU has the potential to radically reorganize the entire idea of computing, moving things distinctly towards a brain-like collection of specialized processing units. I’ve been joking this is OS X SP1 but that’s just not true, Apple is mainlining some serious innovation into the backend of Snow Leopard and this should be a very, very good release.

My plan for this year worked very well. I managed to set aside the week prior to essentially cram on Cocoa and Objective-C. While that was originally supposed to be three weeks, the time I eeked out still helped a great deal. I also maintained a very disciplined focus about which sessions I went to. In the past I’ve flitted around trying to get a taste of every subject that interested me — which is almost everything. This year’s deliberate focus and pre-study nearly eliminated the blank-stare drift I’d experienced in the past and left me feeling more confident than ever about building stuff with Cocoa, writing FXPlugs and making things for iPhone.

But far and away the best thing about this year was the people. Twitter made a lot of this possible by starting conversations beforehand. I think I probably met half my twitterstream in person, which was awesome and kind of funny. The social dynamic of first meeting twitterers is sort of one where everyone treats everyone else like a celebrity. It ended up being this wonderful abstracted feeling of recognition which wasn’t nearly as creepy as it sounds like it would be. My only regret is not meeting the handful of people I knew were there but never crossed paths with.

There are just too many people to call out, but I was blown away by just about everyone I met.


Really last minute WWDC predictions

Short this year, but I wanted to get something up.

  • New iPhone demo
  • iPhone not immediately available
  • 10.6 demo. No, this isn’t 10.5 SP1 (really!)
  • No new MacBook Pro, much as I want one
  • A cleaner architectural re-alignment of OS X from a developer perspective
  • Twitter will melt
  • AAPL will be up at the end of the day
  • I don’t see how they can launch the store until next week. Half the people here would be immediately flooded with support and administrative requests. There will be pre-launch resources available, but the store won’t launch right away.

    10.5 is great, but there are a lot of rough edges. The rumors about 10.6 being previewed are probably true, but I don’t think this will be a $129 upgrade. This will essentially be Service Pack 1. Apple isn’t Adobe, they won’t charge money to fix things that are broken.

    Twitter is going to add such a bizarre additional layer to this.

    And we’re walking in… or at least closer.


On “seat meat” and padding your office

Dan Benjamin linked to a somewhat bizarre product, Thriving Office. While I can completely understand the thought behind this, the absurdity of it makes me a little sad.

I commented about how it was common to pad an office with “seat meat” for client visits. He then replied:

Is that really common? wow that’s a shame. I’d rather have no business than business based on false pretenses.

It depends on how it’s done. There’s nothing wrong with asking assorted freelancers to come in on a specific day. Especially if their being in the office helps convince a client that you’re big enough to handle an assignment, which then allows you to hire those same freelancers for that project.

Branding is fundamentally about crafting how other people perceive a company.

We dress up for meetings, as a sign of respect but also to give the client confidence in us. Is that superficial? Yes. But split-second instant judgements always are. Split-second judgements often make or break a deal.

An empty desk never says anything good about a business in the same way vacant storefronts or lots are bad things for a neighborhood.

As a business, it’s a whole package thing. We dress up. The office is cleaned. Seats are filled. Fresh flowers are put at the front desk. Nice baked goods and fruit are offered. Fresh coffee is brewed.

In a way, everything is a design problem. How a business communicates it’s own image is vital to it’s long term success.


Our sad GE Oven Saga

Normally I don’t like to use this site to vent or gripe, but I’m going to make an exception here.

For the past several months, the oven in our 3.5 year old GE Profile gas range (JGS968) has been half-broken. It leaks gas and won’t stay hot.

The problem is completely reproducible:

  1. Set oven to some common baking temperature, like 350°.
  2. About 5-10 minutes after the oven comes to temperature, the smell of gas will be noticeable. It has essentially “gone out”. The oven will start to lose temperature but the flow of gas seems to continue.

If the oven is turned off and restarted to again bake at 350°, the temperature will start out significantly below the 350° mark. Often, the temperature will then stall, never rising above the first sampled temperature.

The oven can be “re-lit” by rapidly opening and closing the door. Like a bellows. There is an audible ‘poomf’ and the temperature immediately starts rising again.

The stovetop burners work fine. The only time we smell gas is when trying to use the oven.

It should be obvious that this problem makes the oven nearly useless. Besides gassing everyone out of the room, it can’t hold a temperature so baking and slow-cooking are nearly-impossible. At least the broiler works.

I’m a repair guy, see I have a shirt.

So far we’ve had five visits from three different GE repairmen. Of the three, only one was worth paying. Of course we never saw that one again.

The first visit, way back in December, the guy came with some sort of gas-sniffing instrument, poked around for 5 minutes then told me to change the incoming gas line, that GE doesn’t cover that and it just cost me $100 for him to tell me that. I pointed out that there were no gas problems with the stove, which feeds from the same hose, but he insisted, swiped my credit card and left.

The second visit, was the nice and seemingly competent repair guy. After listening and poking around more than any of them, I’m seem to remember this was the only repairman who checked behind the oven, after asking a lot of questions (!), he replaced the igniter, and billed us for the part.

Third and fourth visits were the first guy again, but at least we’d been escalated so no more charges. First he determined it was a part which would need to be mailed to us. Part ordered, next visit scheduled. Next visit, part replaced. He waited a few minutes to be sure it worked, which wasn’t long enough, then left. We tried to cook dinner the next night and the problem was as bad as ever, or slightly worse.

Today I had the worst repair visit ever. After describing our completely reproducible problem in detail, the GE repairman told me that our problem was “not possible”, condescendingly implied that I was confusing the smell of a warm oven with the smell of gas and then left. Sure, I called GE customer service (800-386-1215) and constructively bitched them out, but it still cost me another half day and raised my blood pressure to Bruce Banner levels.

Our next repair is scheduled with an independent service company on April 1st. Fitting.

Epilogue



« Previous PageNext Page »

random

14th St webcam