Showing posts with label howto. Show all posts
Showing posts with label howto. Show all posts

Wednesday, December 23, 2009

Cloning a git repo over ssh on Snow Leopard

I had trouble cloning a git repo between my home iMac and work MacBook Pro, both running Snow Leopard.

It should be as easy as (porkchop-sandwiches is my work machine name. That's right.):

git clone ssh://tony@porkchop-sandwiches.local/~/work/repo

But that was failing with:

bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly

It sounded like the problem was that when logging into ssh I wasn't getting my work machine's user's path, which had all the git stuff in it. This is what I googled: http://stackoverflow.com/questions/225291/git-upload-pack-command-not-found-how-to-fix-this-correctly, and sure enough this command showed that my PATH wasn't what I expected:

ssh tony@porkchop-sandwiches.local echo \$PATH

I tried the solution at stackoverflow, by symlinking .profile to .bashrc but it didn't work even though the PATH was now correct. I don't know what was going on, but one of the other possible solutions on the stackoverflow lead me to this: http://kerneltrap.org/mailarchive/git/2008/6/18/2159464, which I then did, and it then did work. It basically forces SSH logins to execute that custom script as the command, which figures out whether to load .profile or not based on if there was a command passed, and then executes the original command if there was one.

I'm off to the races now!

Posted via email from Tony Hillerson's Posterous

Thursday, July 17, 2008

Use blank fixtures for Bj tables when testing with Bj

I have an integration test where I need to test a web process that starts a background process with Ara T Howard's awesomely named Bj plugin (Background Job - but never has overhearing talk about Rails testing cause so many funny looks and stifled laughs).

I found some great notes here: http://robsanheim.com/2008/07/10/notes-on-testing-bj-background-job/ which show how to wait for a job to finish during a test.

One problem I ran into, though, was that I somehow had a bad job that got stuck in the testing database table, and that was messing up testing results because Bj would wake up during the test, see the old bad job, and resubmit it. It took a while to track that down.

I fixed it by simply putting blank fixtures in test/fixtures for each of the Bj tables: bj_config, bj_job, and bj_job_archive. That way Bj starts from a blank slate when each test starts. There's a Bj protip for you. Another one is to watch the Bj logs for the test environment.