Git

We have the Git client available at Kinsta, so you can access your site with SSH and pull your Git repo down from GitHub, GitLab, Bitbucket, or any other third-party. SSH access is available on all of Kinsta’s hosting plans.

We don’t yet have the feature of using git push kinsta my_site to automatically deploy, but you can still use Git at Kinsta by following the instructions below.

Another way of doing this is to utilize WP Pusher. Many of our clients use this and it makes it super easy, as you don’t have to know how to use Git or SSH.

Austin also has an excellent tutorial on how to set up automatic Git deployment with Kinsta using SSH.

Some other alternatives include Beanstalk and DeployBot. Otherwise, you can follow the more detailed Git instructions below.

Preparation and notes

You can create a deployment script that will access your site’s container via SSH and pull the latest version of your repo to your site.

You will need your SSH details and Path for your Kinsta site, which can be found on the Info page of your site in MyKinsta  (WordPress Sites > sitename > Info).

Path and SSH terminal command in MyKinsta.
Path and SSH terminal command in MyKinsta.

In the examples below, we’re using GitHub. If you’re using a different service, replace the GitHub URL with your repository’s URL.

Pull repo

The command to pull your repo to your public directory will look something like this:

ssh user@ip-address -p portnumber "cd public-root && git pull https:// github.com/USER/REPO.git "

Replace the bold values with your site’s details from MyKinsta:

  • Replace ssh user@ip-address -p port-number with the SSH terminal command in MyKinsta (WordPress Sites > sitename > Info > SFTP/SSH).
  • Replace public-root with the Path in MyKinsta (WordPress Sites > sitename > Info > Environment details).

Pull a private repo

If it’s a private repo, you’ll need a way to authenticate or log in. Here’s an example of pulling a private repository from GitHub by adding login credentials to the command:

ssh user@ip-address -p portnumber "cd public-root && git pull https:// username:password @ github.com/USER/REPO.git "

Pull a private repo with 2FA

If two-factor authentication is enabled, an access token/app password is needed. Here are instructions from some popular services on how to create a token to authenticate your command:

Here’s an example of how to pull a repo that has 2FA enabled from GitHub, using a token to authenticate:

ssh user@ip-address -p portnumber "cd public-root && git pull https:// TOKEN @ github.com/USER/REPO.git "

Note: If the git pull above doesn’t contain credentials and the HTTPS path, it will attempt to look locally (rather than at the hosted repo) and show the message: “Everything up-to-date.”

Clone repo

To clone a repo:

git clone https:// github.com/USER/REPO.git

Clone a private repo

If it’s a private repo, you’ll need a way to authenticate or log in. Here’s an example of pulling a private repository from GitHub by adding login credentials to the command:

git clone https:// username:password @ github.com/USER/REPO.git

Clone a private repo with 2FA

If two-factor authentication is enabled, an access token/app password is needed. Here are instructions from some popular services on how to create a token to authenticate your command:

Here’s an example of how to clone a repo that has 2FA enabled at GitHub, using a token to authenticate:

git clone https:// TOKEN @ github.com/USER/REPO.git
Was this article helpful?