Creating your own code repository to back up your Raspberry Pi code.
Make sure you have a github account. Note your username (you'll need it for a future step)
2. Create a personal token by following these steps.
You'll need to save this token somewhere as you will not be able to see it after the process is complete.
3. Create a new empty repository in your account following the first steps in this tutorial. You can call it pi_backup or name it the same thing as the folder you want to back up.
3. Back on the pi, navigate to your the directory you want to back up to github:
Open the terminal and navigate to the directory where your code is located.
$ cd /path/to/your/project
4. Initialize the new git repository (if not already initialized):
$ git init
5. Next, type or paste the following, adding your token, your username and the name of the repository you created in step 3.
$ git remote add origin https://YOURTOKEN@github.com/YOURUSERNAME/YOURREPO.git
Now you're all set to add and commit files. You won't have to perform the first five commands again on this Pi.
6. To commit new files:
Place or save any files you want to back up to Github in the repository file on the Pi.
In the command line, If you're not in the folder cd into the folder:
$ cd /path/to/your/project
$ git add .
$ git commit -m "anything you want"
$ git push -u origin master
Additional Helpful command:
To see what URL your Git remote is set to, you can use the following command:
$ git remote -v