Github I#

Overview#

GitHub is …

Beginners Guide#

Github description

Other Ressources:


How it works#

May be a walk through example

Commands#

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:

git log

To check what is the history of the latest commits

Upload JupyterBook on Github#

Few rules

  • 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#

Warning

How about only pushing on github the _build folder ?

  • What is best coding practise ?

Note

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

git status

You should get the following message:

fatal: not a git repository (or any of the parent directories): .git

It’s normal.

git init

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)

git status

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)

git status

and we are on the branch main so we can go forward by running

git add *

/* means all.

Note

If you need some files (folders to be ommited), just add them to your .gitignore file

notepad .gitignore

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"

and then

git remote add origin git@github.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

Potential issues#

Authentification#

Here is a potential issue that can arise when you try to push your book online (for the first time).

../_images/Github_issue1.png

Fig. 7 19/12/2022#

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

  • link 1 - Generate a new SSH key
  • link 2 - Add this new SSH key to your Github account

Note

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.

Github pages#

Specific features#

Password your GH pages Book#
  • Access control

Organization#



Netlify#

Auto generate your live site

Comments#



Notes

Page


  • Author: Vincent Deguin;

  • Status: flag alt > 🔎

  • Reviewed:

  • Updated: 28/05/2023

flag alt >Help




or


flag alt > Patreon