GitHub is …
Real Python - Intro guide
How it works#
May be a walk through example
Delete git commits#
This is needed when you try to push a commit and it doesn’t work (they can be many reasons for that)
The best command to use is
git rebase -i HEAD~2
Best to do:
To check what is the history of the latest commits
Upload JupyterBook on Github#
you can’t upload files bigger than 100 MB (Or you need to use git LFS system)
Create your git repository#
Push your book online#
How about only pushing on github the _build folder ?
What is best coding practise ?
Before to go through the procedure there is a few things I advise you to do:
create the 2 following files
.gitignore file - use this tool gitignore-generator
.nojekyll file - will prevent github to rebuild your book with Jekyll (what is it actually)
First you need to open a terminal window and locate yourself in the repository you want to commit
Run the command
You should get the following message:
fatal: not a git repository (or any of the parent directories): .git
will give you the following message
Initialized empty Git repository in G:/MAMP/htdocs/PhD-WS/PhD/.git/
Ok so now we have created an empty git repository within wich we can put all our content before to push it to Github.
If we run: (again)
We will have a different message like (in my case):
So now you can see that we are in the branch master. In order to get to the branch main
git branch -M main
then (always do that)
and we are on the branch main so we can go forward by running
git add *
/* means all.
If you need some files (folders to be ommited), just add them to your .gitignore file
to modify this file
This will add all the files into your local git repository.
Then what you need to do is run
git commit -m "first commit"
git remote add origin email@example.com:Deugz/nb-phd.git
will link the two repos, Github (cloud …) and the local git repo you have created
finally you push
git push -u origin main
Here is a potential issue that can arise when you try to push your book online (for the first time).
In that case, Github doesn’t recognise me as the owner of the repository. In order to sole this issue I need to find a way to authentificate myself and this can be done in two ways:
HTTPS: identification using identification and password
SSH: identification using a single key.
As far as I am aware, HTTPS is not supported anymore by Github so in the following line we will focus on setting up a SSH key
modify the links with new formatting (picto - red)
Explain the different steps
format correctly and send to Ross along with JB tutorial for him to try and generate his own book.
Password your GH pages Book#