---
description: >-
  it's important to backup your printer settings in a safe place. Believe me,
  learned that the hard way. In this article we will see how to create a backup
  of your printer settings and save them on GitH
---

# Creating a GitHub backup for Klipper

## Creating a new GitHub repo.

You first need to have a free account on [www.GitHub.com](https://www.github.com). Either sign up and follow the instructions or sign in if you already have an account.&#x20;

Next you will need to create a new Repository (aka repo) by clicking `New`.

![](https://3110294014-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI_J-t0wBmZZAxJWVw3%2F-MKoMGSKflcWiVhpXgcZ%2F-MKoNXNCP5tgOEdGg1pt%2FScreen%20Shot%202020-10-29%20at%208.42.55%20AM.png?alt=media\&token=1168eac3-098d-4f3c-b9b7-d13724b84860)

Give a name to your repo like "klipper\_gonfig" (which is the name of the folder we will backup) then click `Create repository` at the bottom of the page.

keep the window open, you will need the URL address later.&#x20;

## Backup your settings

### SSH into your printer

Now that we have our GitHub repo setup, we can move to our printer. Open your terminal and connect via SSH into your Raspberry Pi.&#x20;

### Install git

We will be using git to backup our settings so if you haven't installed it yet, do:

```
sudo apt-get install git -y
```

### setup git

No let's navigate to our `klipper_config` folder and setup your git.

```
cd ~/klipper_config/
git init
git remote add origin <Your-GitHub-Repo-URL>
git add .
git commit -m "my first backup"
git push -u origin master
```

* Make sure to replace `<Your-GitHub-Reop-URL>` with your actual URL from before.&#x20;
* The `.` is important in `git add .`&#x20;
* You can replace "my first backup" with anything you want.

You will then have to enter your email and password (nothing will show on screen while you type your password, it's normal) you used for GitHub and the backup will start. When it's over you can refresh your GitHub repo page and you should see all your config files! You did!

### Next backups

Next time you want to backup your printer settings, you need to SSH into your pi and type:

```
cd ~/klipper_config/
git add .
git commit -m "backup"
got push -u origin master
```

Enter your GitHub credentials and you're done!

## Restore your settings

Oops! Something happened and you need to go back to your settings you backed up in GitHub. It's okay, take a deep breath.&#x20;

There are multiple ways to access your backup.&#x20;

### Copy on GitHub.com

You can simply go to your repo on GitHub.com and see all your settings, you can copy/paste any line and replace it in your current settings file. This is useful if you only need to go replace a section of your document.&#x20;

### Restore with git

* If you need to completely restore your settings in the already existing local folder:&#x20;

```
cd ~/klipper_config/
git fetch -all
git reset --hard origin/master
```

> **WARNING! This will delete all your settings in your printer folder and replace them with your backup. You will lose any change that was not backed up!**

* If you are starting from a new install and need to restore your settings from your previous setup:

```
cd ~
git clone <Your-GitHub-Repo-URL>
```





