Tab Completion

I'm Tab Atkins Jr, and I wear many hats. I work for Google on the Chrome browser as a Web Standards Hacker. I'm also a member of the CSS Working Group, and am either a member or contributor to several other working groups in the W3C. You can contact me here.
Listing of All Posts

How To: Manage your dang website via git (specialized for NearlyFreeSpeech)

Last updated:

This is a reminder post for myself, because I just had to re-clone my website on my local machine and futzed about for half an hour before figuring it out. This advice should generally apply for any other host, if you're running into this post from Google or something, you'll just have to change the exact folders used.

Setting up a new website

Go into /home/private. Make a new folder, like domainname.git. cd into there. Run git init --bare.

Almost there! Head into hooks. Create a post-receive file containing:

GIT_WORK_TREE=/home/public git checkout -f

Mark it executable with chown +x post-receive.


Cloning it into a personal computer

Okay, so you remember your ssh login details: the @ address and the password. For NFSN, this is {username}_{sitename}

Now just:

git clone <ssh-address>:/home/private/domainname.git website

It'll ask for a password, then ta-da!

Setting up SSH keys

Passwords are annoying.

Find your SSH keys, they're probably named sshkey and or something.

SFTP into your website server. (Identical to the ssh command.)

Head to /home/private, make a .ssh folder. cd into it. Upload your public and private keys.

Since this is NFSN, the next step is to tell the admin interface about your keys. I won't go into the steps there, they have a guide.

Now back on your local computer, set up an sshagent script:

eval `ssh-agent -s`
ssh-add ~/.ssh/sshkey
ssh-agent -k

(Modify path to the private key if necessary.)

Pop in it ~/bin or wherever, mark it executable, and run it.

Now when you use git, it'll use your keys rather than asking for a password!

(a limited set of Markdown is supported)