Documentation

Can I use Git to manage my website?

Last Updated: June 20, 2024 11:55 AM

Git is a powerful development tool which enables developers or a development team to securely push code changes from their local machine to their site on WP Engine with the benefit of version control.

Installing Git

Git is already installed on your website. If you open an ssh connection to your website, you will find the git command is available to you.

Uploading Your Public Ssh Key

In order to access the remote repository and push from your local machine, you need to first upload a publish ssh key. The key should be placed in the folder 

/usr/src/app/.ssh/

Initialize the base WordPress directory as a Git repository.

Change the current working directory to your local project, and then run the following command.

git init

Add the files in your new local repository and make a first commit

git add . git commit -m "First commit"

Add a remote repository

A remote repository will be a repository of the website code stored somewhere other than where it is being hosted - for example a newly created github repository. In order to authenticate to the remote repository, you must credentials either within the URL or as SSH keys.

git remote add origin remote repository URL

Sync or push your files to the remote repository

git push -u origin master