---
title: "Maintaining Your Deployments in GitHub"
description: "In this article, we will outline the process of using Git to handle versioning a repository and keeping a copy on a GitWeb provider as a backup, or for sharing. This article assumes that you have..."
url: https://www.inmotionhosting.com/support/edu/ansible/backup-and-version-control-ansible-playbook/
date: 2020-04-01
modified: 2021-06-11
author: "InMotion Hosting Contributor"
categories: ["Ansible Tutorials"]
type: post
lang: en
---

# Maintaining Your Deployments in GitHub

In this article, we will outline the process of using Git to handle versioning a repository and keeping a copy on a GitWeb provider as a backup, or for sharing.

This article assumes that you have already received a copy of the [WordPress UltraStack playbook](https://www.inmotionhosting.com/support/edu/ansible/end-to-end-guide-to-deploy-wordpress-ultrastack-using-ansible-and-git/), and want to retain custom changes to the playbook by using Git. You may use any GitWeb provider you prefer, though we will use GitHub to provide an overview of this process.

**NOTE:** Do not push sensitive information contained in your Ansible Playbook inventory to a public repo! Be sure to remove sensitive information from files you commit!

[Sign up for a GitHub account](https://github.com/join) if you don’t already have one.

## Backup Ansible

1. Add your Ansible Control Agent SSH public key to GitHub. The following steps are an abridged outline of the official steps available at [Github.com](https://help.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account) or you can follow below
2. Visit [https://github.com/settings/keys](https://github.com/settings/keys)
3. Click **New SSH key**![](https://www.inmotionhosting.com/support/wp-content/uploads/2020/04/github-new-ssh-key.png)
4. Add the public key to the input field:![](https://www.inmotionhosting.com/support/wp-content/uploads/2020/04/github-ssh-key-paste.png)
5. Click the **Add SSH key** button
6. Visit our [WordPress-UltraStack-Ansible Github page](https://github.com/inmotionhosting/wordpress-ultrastack-ansible)
7. Click the **Fork** button
8. On your fork, click the **Clone or download** button
9. Choose **Clone with SSH** if not already selected
10. Add this repo to your playbook:git remote add my-fork <url you copied>Feel free to replace ‘my-fork’ with any keyword, though infuture sections we will reference the repo keyword specifiedhere.
11. Review your changes to the Playbook**NOTE:** Do not push sensitive information contained in your Ansible Playbook inventory to a public repo!!! Be sure to remove sensitive information from files you commit!
12. Check the status of your playbook:git statusOn branch masterYour branch is up to date with 'origin/master'.Changes not staged for commit:(use "git add <file>..." to update what will be committed)(use "git checkout -- <file>..." to discard changes in working directory)        modified:   ansible.cfgno changes added to commit (use "git add" and/or "git commit -a")
13. Double-check what was changed in the listed file(s):git diffdiff --git a/ansible.cfg b/ansible.cfgindex 27b30c3..e9902ee 100644--- a/ansible.cfg+++ b/ansible.cfg@@ -12,7 +12,7 @@ callback_whitelist = profile_tasks, timerforks = 25host_key_checking = Falseinternal_poll_interval = 0.01-nocows = 1+nocows = 0stdout_callback = yamlvar_compression_level = 9@@ -23,4 +23,4 @@ timeout = 300pipelining = True-retries = 1+retries = 3Looks good? Let’s commit!
14. Add and push your changes in a new commit
15. Add the file(s) to a staged commit:git add ansible.cfg
16. Add a helpful commit message of what you changed:git commit -m "ansible.cfg: enable cowsay; retry ssh 3 times" ansible.cfg: enable cowsay; retry ssh 3 times1 file changed, 2 insertions(+), 2 deletions(-)
17. Push your changes:git push my-fork masterCounting objects: 3, done.Delta compression using up to 8 threads.Compressing objects: 100% (3/3), done.Writing objects: 100% (3/3), 420 bytes | 420.00 KiB/s, done.Total 3 (delta 1), reused 0 (delta 0)remote: Resolving deltas: 100% (1/1), completed with 1 local object.To github.com:<your GitHub user>/wordpress-ultrastack-ansible.giteb1bf94..eafd54c  master -> master

Discover more about IT automation in our [Ansible Education Channel](https://www.inmotionhosting.com/support/edu/ansible/).

For further reading, learn [How to Deploy Files With GitHub Actions for FTP and SCP](https://www.inmotionhosting.com/support/website/git/deploy-files-github-actions/).

Get our Ansible Control Node to automate deployments now with our [Cloud Server Hosting](https://www.inmotionhosting.com/cloud-vps).
