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:
#!/bin/sh GIT_WORK_TREE=/home/public git checkout -f
Mark it executable with chown +x post-receive
.
Done!
Cloning it into a personal computer
Okay, so you remember your ssh login details: the Now just: It'll ask for a password, then ta-da! (But see below for a different clone command for password-less access.) Passwords are annoying. Find your SSH keys, they're probably named SFTP into your website server. (Identical to the ssh command.) Head to 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: (Modify path to the private key if necessary.) Pop in it ~/bin or wherever, mark it executable, and run it. Also set up an And now, instead of cloning with the explicit address as described above, clone with: Now when you use git, it'll use your keys rather than asking for a password!{username}_{sitename}@ssh.phx.nearlyfreespeech.net
.git clone <ssh-address>:/home/private/domainname.git website
Setting up SSH keys
sshkey
and sshkey.pub
or something./home/private
, make a .ssh
folder. cd
into it. Upload your public and private keys.eval `ssh-agent -s`
ssh-add ~/.ssh/sshkey
$SHELL
ssh-agent -k
exit
.ssh/config
file (create it if it doesn't exist), adding:Host nfsn
Hostname ssh.phx.nearlyfreespeech.net
User {username}_{sitename} (fill these in!)
IdentityFile ~/.ssh/sshkey
git clone nfsn:/home/private/domainname.git website