Skip to content

Instantly share code, notes, and snippets.

@justinatack
Last active November 24, 2017 14:07
Show Gist options
  • Save justinatack/999e9583604a50590011df409fc4e952 to your computer and use it in GitHub Desktop.
Save justinatack/999e9583604a50590011df409fc4e952 to your computer and use it in GitHub Desktop.
Create and Link Vultr with ServerPilot Public Key to Bitbucket Repository

Link Vulr with ServerPilot to BitBucket Repository

The following information is for Vultr/ServerPilot and BitBucket users. In principle the following should apply for any server/git combination, but with variations. This information specifically applies to Ubuntu 16.04.

SSH into Vultr Server

SSH into your Vultr server using your serverpilot user.

ssh [email protected]

Add New Public/Private SSH Keys

cd ~/.ssh/
ssh-keygen -t rsa

Enter your key name, for example bitbucket_rsa. You do not need to add a password. If you plan to use a deployment script that fetches your repo automatically then do not add a password.

Add BitBucket to SSH Config

cd ~/.ssh/
nano config

Paste in the following

Host bitbucket.org
IdentityFile ~/.ssh/bitbucket_rsa

Rename bitbucket_rsa if you have named it differently.

crlt+x to exit, press ENTER to save.

Add Public Key to BitBucket

Echo the public key code to screen and copy.

cd ~/.ssh/
cat bitbucket_rsa.pub

Open your browser and visit bitbucket.org > Select Repository > Settings > Access Keys > Add Key

Give your key a name, for example Vultr Server and paste in your public key.

Test it Works

cd ~/apps/your-app/
mkdir tmp
cd /tmp
git clone [email protected]:username/repo.git .

It should fetch your repository without the need for a password. You can tidy up by safely deleting the tmp directory with rm -rfv tmp/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment