In addition to using git, which you’re already doing, you should also clone the class repo from GitHub.
Note: remember that you are not creating your own GitHub repo for this class, nor pushing to it. These instructions are just about downloading your own copy of my files in the common way.
Before you clone the class repo, you need to make sure that:
You normally only need to do this setup once per computer.
Go to:
https://github.com
If you do not already have an account, create one.
Remember your GitHub username; you will use GitHub throughout the course, and throughout life.
Open a terminal.
Run:
git --versionIf you see something like:
git version 2.43.0
you already have Git installed.
If Git is not installed, install it before continuing.
sudo apt install gitRun:
xcode-select --installand follow the instructions that appear.
Download and install Git for Windows from:
https://git-scm.com/download/win
After installing it, close and reopen PowerShell.
Git records the author of every commit.
Run these commands, substituting your own name and email address:
git config --global user.name "Your Name"git config --global user.email "you@example.com"You can check the result with:
git config --global --listWhen your computer communicates with GitHub, GitHub needs a way to know that you really are you.
One common way to do this is with an SSH key.
An SSH key actually consists of two related files:
The private key is secret. Never email it, upload it, or give it to anyone.
The public key is safe to share. Once you give the public key to GitHub, GitHub can recognize connections made using the corresponding private key on your computer.
You can think of the public key as telling GitHub:
“This particular computer is allowed to act as me.”
We are going to create an SSH key on your computer and then give GitHub the public half of it.
Open your terminal or PowerShell and run:
ssh-keygen -t ed25519You will see a prompt similar to:
Enter file in which to save the key:
Press Enter.
This accepts the normal default filename and location.
Next, you will be asked for a passphrase:
Enter passphrase (empty for no passphrase):
For this course, it is okay to press Enter to leave the passphrase empty.
It will ask again:
Enter same passphrase again:
Press Enter again.
You should now have two new files.
☞ Linux:
They will normally be:
~/.ssh/id_ed25519
~/.ssh/id_ed25519.pub
☞ macOS:
They will normally be:
~/.ssh/id_ed25519
~/.ssh/id_ed25519.pub
☞ Windows:
They will normally be inside the .ssh folder in your
home folder.
The file:
id_ed25519
is your private key.
Do not share it.
The file:
id_ed25519.pub
is your public key.
That is the one we are going to give to GitHub.
Run:
cat ~/.ssh/id_ed25519.pubRun:
cat ~/.ssh/id_ed25519.pubRun:
Get-Content $HOME\.ssh\id_ed25519.pubYou should see one long line beginning with something like:
ssh-ed25519
Select and copy that entire line.
Do not copy the contents of id_ed25519.
You want the file whose name ends in:
.pub
In GitHub:
Click your profile picture in the upper-right corner.
Choose Settings.
Choose SSH and GPG keys.
Click New SSH key.
Give it a useful title, such as:
My laptopLeave the key type as Authentication Key.
Paste the entire public key you copied into the Key box.
Click Add SSH key.
GitHub now knows that your computer’s SSH key belongs to your account.
Return to your terminal or PowerShell and run:
ssh -T git@github.comThe first time you do this, you may see a message asking whether you trust GitHub’s host.
It may end with something like:
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Type:
yes
and press Enter.
If everything is working, you should then see a message similar to:
Hi yourusername! You've successfully authenticated, but GitHub does not
provide shell access.
The important words are:
You've successfully authenticated
Your computer can now communicate with GitHub using SSH.
Now you can download your own local copy of the DATA 419 repository.
First, use cd to navigate to your home folder. Open a
terminal and type cd by itself, then press Enter.
Then run:
git clone git@github.com:divilian/data419.gitGit will create a new folder called:
data419
Move into it:
cd data419You now have your own local copy of the class repository.
You can ask Git where the repository came from:
git remote -vYou should see something containing:
git@github.com:divilian/data419.git
You can also list the files.
☞ Linux:
ls☞ macOS:
ls☞ Windows PowerShell:
Get-ChildItemYou should now see the files from the class repository.
Permission denied (publickey)If you see:
Permission denied (publickey).
then GitHub is not recognizing your SSH key.
First try:
ssh -T git@github.comIf that does not report that you successfully authenticated, check that:
id_ed25519.pub, not
id_ed25519,ssh-keygen is not
recognizedIf Windows says that ssh-keygen is not recognized as a
command, make sure Git for Windows has been installed, then close and
reopen PowerShell.
If you discover that you already have files named:
id_ed25519
id_ed25519.pub
you do not need to create another key.
You can simply display the existing .pub file and add
that public key to GitHub.