Skip to content

Git Basics

All applications on Vapor Cloud get a free private repository on Vapor Cloud which you use to deploy code.

Before you can use it, you need to setup your public key on Vapor Cloud.

Setup Git Access

Git keys give you access to Vapor Cloud's private Git server. To setup git keys, you need to get the contents of your public SSH file. It's usually located at ~/.ssh/id_rsa.pub, but my vary.

To get the content you can run the following command:

cat ~/.ssh/id_rsa.pub

It's only one line. Copy the entire output.

Tip

On MacOS you can also just run

pbcopy < ~/.ssh/id_rsa.pub

This will copy the output of the file automatically

Next, in the dashboard, navigate to the Settings page using the main menu. Then, click the + button in the SSH keys section.

Setup key

Give your SSH key a recognizable name and paste the contents of the key. Then, click create.

Note

This might take a few seconds to create.

After this you should be able to verify access by running.

ssh git@git.code.vapor.cloud

The output will look something like this:

PTY allocation request failed on channel 0
Hi jonas@vapor.codes, You've successfully authenticated to Vapor Cloud Git
 R W    night-long-14474
 R W    sun-ancient-43997
Connection to git.code.vapor.cloud closed.

Setup Git

If you already have a Vapor app, you can easily setup your repository locally.

To do this, run the following command:

git remote add cloud git@git.code.vapor.cloud:...

Note

We always recommend setting up the Vapor Cloud git on the cloud remote, so you can keep e.g. Github on origin

Note

You need to replace ... with your app slug, you can get the full remote from the dashboard.

Push to git

To push to git, simply do

git push cloud master

Test access

To verify you have access, you can run

ssh git@git.code.vapor.cloud

This will print output with your Vapor Cloud Email, and a list of applications you have access to.

Troubleshooting

If you get the following message:

git@git.code.vapor.cloud: Permission denied (publickey).

It's maybe because you use a key that it not id_rsa. To fixing this problem add the following lines inside the ~/.ssh/config file (remember to replace YOUR_KEY with the name of the file that contains the private key):

Host git.code.vapor.cloud
  HostName git.code.vapor.cloud
  IdentityFile ~/.ssh/YOUR_KEY
  IdentitiesOnly yes