Table of Contents

How to turn a local folder into a GitHub repo

First, git init in the local folder following this post. Then, the rest of the steps as written here.

Basics for how to commit changes and push to remote branch

First, stage all the changes:

$ git add .

Then, check if you have staged all that you would like to stage:

$ git status

Next step is to commit the files locally with a message:

$ git commit -m "message here"

Last, push the changes to the remote repo “gh-pages”:

$ git push origin gh-pages

Set the default programming language for a repo

Reference

GitHub uses a library called Linguist to identify the top language used in a repo. The identification can be either automatic or self-specified. In order to specify the language, make a file called .gitattributes in the root folder and write the following lines based on the programming language used:

*.Rmd linguist-detectable=true
*.ipynb linguist-detectable=false

How to have two or more GitHub accounts on one local machine

How to have two or more GitHub accounts on one local machine (Windows)

How to change contents in fork based on changes in original repo

Note that the second article neglected to mention one setting in GitHub that might cause a “[remote rejected]” error. In the repo that you would like to change, there is a green “Clone or download” button.

Clone or download button

After clicking on it, you will find that the default is to clone with HTTPS.

Clone with HTTPS

Since we set up authentication with an SSH key based on the first link above, it is important that we choose “Use SSH” for authentication. Once we click on “Use SSH”, we see the following:

Clone with SSH

This way, we could proceed to push the changes to the server and not worry about being rejected by the remote.