Creating a GitHub backup for Klipper
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 new GitHub repo.

You first need to have a free account on www.GitHub.com. Either sign up and follow the instructions or sign in if you already have an account.
Next you will need to create a new Repository (aka repo) by clicking New.
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.

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.

Install git

We will be using git to backup our settings so if you haven't installed it yet, do:
1
sudo apt-get install git -y
Copied!

setup git

No let's navigate to our klipper_config folder and setup your git.
1
cd ~/klipper_config/
2
git init
3
git remote add origin <Your-GitHub-Repo-URL>
4
git add .
5
git commit -m "my first backup"
6
git push -u origin master
Copied!
  • Make sure to replace <Your-GitHub-Reop-URL> with your actual URL from before.
  • The . is important in git add .
  • 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:
1
cd ~/klipper_config/
2
git add .
3
git commit -m "backup"
4
got push -u origin master
Copied!
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.
There are multiple ways to access your backup.

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.

Restore with git

  • If you need to completely restore your settings in the already existing local folder:
1
cd ~/klipper_config/
2
git fetch -all
3
git reset --hard origin/master
Copied!
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:
1
cd ~
2
git clone <Your-GitHub-Repo-URL>
Copied!
​
​
​
Last modified 1yr ago