This post is more for my own use than anything else. These are common snippets I use that I’ve jotted down to jog my memory whenever I need them.
apt-get install git
rsync the SSH key to computer
We need to make sure the VPS is trusted from the git repo (Bitbucket, Github, etc).
Create the key:
ssh-keygen -t rsa -C "firstname.lastname@example.org"
Then download the key:
rsync -avzh email@example.com:/~.ssh/id_rsa.pub /Users/joetannorella/sites/
Then copy the contents of the key:
cat id_rsa.pub | pbcopy
To copy contents of a file from Mac
cat ~/Desktop/ded.html | pbcopy
To use an SSH key from Mac with a Nix server
Something I was getting wrong (I know this sounds ridiculous!) is that I was generating the SSH key on the SERVER side, NOT on the CLIENT side.
That was the problem.
You must generate the SSH key pair on the client side, and then transfer the public key over to the authorised file under ~/.ssh on the server.
To do this:
Generate the keypair:
ssh-keygen -t rsa
Then copy over the public key to the server. The following line assumes that no .ssh folder is present:
cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
MySql Local to Live
Export local DB to file within the local Git repo, and then sync up with Git repos so it’s on the live server.
Log in to MySql:
mysql -u <user> -p
Then load the SQL from the file now on the live server. From the current directory:
mysql> source sqlfile.sql
Rsync using a non-standard port (for shared hosting)
rsync -avzh -e "ssh -p <port>" <user>@<server>:<server_file_location> <local_destination_location>
WordPress file persmissions
sudo chown -R www-data:www-data public