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
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
Give a name to your repo like "klipper_gonfig" (which is the name of the folder we will backup) then click
Create repositoryat the bottom of the page.
keep the window open, you will need the URL address later.
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.
We will be using git to backup our settings so if you haven't installed it yet, do:
sudo apt-get install git -y
No let's navigate to our
klipper_configfolder and setup your git.
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.
.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 time you want to backup your printer settings, you need to SSH into your pi and type:
git add .
git commit -m "backup"
got push -u origin master
Enter your GitHub credentials and you're done!
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.
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.
- If you need to completely restore your settings in the already existing local folder:
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:
git clone <Your-GitHub-Repo-URL>