You are currently viewing the new Beta Editor Docs.
Switch to the Classic Editor Docs
You are currently viewing the Classic Editor Docs.
Switch to the Beta Editor Docs

Setting up an SSH key to clone your Anvil app with Git


If you want to git clone an Anvil app from the editor onto your machine, you’ll need to prove who you are. The most robust way to authenticate Git access is to set up an SSH key.

This guide will show you how to set up an SSH key on an Linux server, add the SSH key to your Anvil account and clone your Anvil app onto your server with Git. (This guide was written for Ubuntu 20.04, but the instructions should be the same for any modern Linux distribution.)

Step 1 - Generating the key pair

First, let’s create a key pair on your Ubuntu server. Start by running the command:

$ ssh-keygen

You should see the following output:

Generating public/private rsa key pair.
Enter file in which to save the key (/your_home/.ssh/id_rsa):

Press enter to save the key pair into the .ssh/ subdirectory in your home directory.

You will then be prompted for a passphrase. It’s recommended that you enter one, however it isn’t compulsory.

Enter passphrase (empty for no passphrase):

Next you will see an output similar to:

Your identification has been saved in /your_home/.ssh/id_rsa
Your public key has been saved in /your_home/.ssh/
The key fingerprint is:
SHA256:+tHymFI4fMGcyKZ8DPUbGZekbnZZM2tVXYelf5Vwzt4 user@host
The key's randomart image is:
+---[RSA 3072]----+
|         ... . +B|
|      . ..o   *o+|
|     o =.=  + o+.|
|    . +.O  o =..o|
|   . * .S+o o  .E|
|    o *++o .    .|
|     ..+o .      |
|      .. *       |
|       .+ .      |

Now you have a public and private key that we can use for authentication between your server and Anvil (or any other Git server).

Step 2 - Copying your Public key

Next, let’s get your Public key: $ cat ~/.ssh/

That will show you the public key, which you can then copy to your clipboard:

Z4YYm8SeFcmTTo8Ji07UslhmOapGh6frDUZGRWiznuxpHp2AUcCt6uH2uUxuQxwoQhkzUHE= user@host

We will then add this public key to your Anvil account.

Step 3 - Adding the public key to your Anvil account

Login to your Anvil account and open the app you would like to clone to your Ubuntu server.

Click the Clone with Git button in the Version History dialog and paste the public key into the SSH public key box.

Git Access

Git access

Step 4 - Cloning your Anvil app onto your server

Now we have our keys set up, we can clone our Anvil app onto our server using the command found at the top of the Git access screen.

It will look similar to:

$ git clone ssh:// AppName

If you entered a passphrase when creating your SSH key in step 1, you will be prompted for the passphrase.

Your app will now be cloned to your Linux machine and is ready to use with the Anvil App Server.