Install git:
sudo apt-get install git-core
.Create an account on GitHub: https://github.com/
Tell git your name and email address. Open up a terminal and type:
If you are worried about email privacy, then use “<username>@users.noreply.github.com” as your email address (where you have replaced <username> with your GitHub username), then follow the instructions here to make your email address private on GitHub.
Choose your favorite editor to be your default
Nano (a simple text editor):
Notepad (Windows only):
Emacs (for the brave) if it is already installed:
To integrate GitHub (the website) with git (the command-line program), you have to set up the proper authorization.
If you can already integrate with GitHub through the command line then you can skip the rest of these notes. If you are not sure, then please continue.
GitHub now requires you to use either Personal Access Tokens or SSH Keys for interfacing. For this class, we’ll use SSH Keys since its implementation is slightly easier.
An alternative setup using personal access tokens can be found here.
SSH uses what’s called a key pair where GitHub has a “public key” (a very long publicly known password) and you have on your computer a “private key” (a very long privately known password).
Think about the public key as a padlock, and the private key as the key. You have to use to private key to unlock the public key.
You need to generate a new private key, and go through the below steps, for each computer for which you intend to use git.
R Studio makes it easy to generate a key pair.
Check to see if you already have an SSH key pair by running the following in R
It will return FALSE
if you do not have a key
pair.
Open up Tools > Global Options… > Git/SVN.
If you do not have an SSH key pair, then click on “Create SSH Key…” and follow the prompts.
Click on “View public key”
Copy the entire text that shows up. This is your public key.
Go to Add Public Key to GitHub to continue authentication setup.
In the terminal run
This will say something like “ls: cannot access ‘/c/Users/Vlad Dracula/.ssh’: No such file or directory” if you don’t have any public/private key pairs.
This will list out files names like “id_rsa.pub”, “id_ecdsa.pub”, or “id_ed25519.pub” if you do have a public/private key pair.
If you do have an SSH key, go to the next section (“Add an SSH key to the ssh-agent”)
If you don’t have an SSH key, follow the below steps.
In the terminal, run
Press enter if prompted where to save the key to accept the default location.
At the prompt, type a password that you can remember.
In the terminal, run the following to start the ssh-agent in the background.
In the terminal, run the following to add your SSH private key to the ssh-agent:
On GitHub, in the upper right corner, click on your profile photo and click on “Settings”
On the left sidebar, click on “SSH and GPG keys”
Click on “New SSH key”
In the title field, choose a descriptive title, like “Personal Laptop”.
Paste your key into the “Key” field.
Click “Add SSH key” and confirm your GitHub password.