GitHub Setup
Last updated
Last updated
You will be using Github individually and collaboratively. We will set up your development environment to be able to communicate with your Github account. You'll be able to clone code from a remote repo using SSH and make changes to it on your computer.
Table of Contents:
. Remember the email and username that you enter. If you already have one, you can skip to the next step.
In your Terminal application (the folder you're in doesn't matter), we first want to ensure that you can use the git
tool for the next few steps.
Start by running the command git --version
which will print the current version of the git
tool on your computer.
If you are using a Mac and this is your first time, a popup called Install Command Line Developer Tools will appear. Follow the instructions to install on your computer.
Once this is done, in your Terminal, run the following lines. Be sure to replace Your Name
and Your Github Email Address
with your actual Github login information:
Confirm that the configuration was successful by running
The terminal should print out your name and email.
Navigate to Github in the browser and log in. ON the left, click the button to create a new repository.
Name your repository my-first-repo
. Choose to add a README.md file. Create the repository.
While we're configuring GitHub, we should add a new SSH key to allow you to push and pull from Github using SSH.
First, check if you already have an SSH key by running ls ~/.ssh
. If the terminal prints out a file(s) that look like id_ed25519.pub
then you already have a key.
If the running previous step printed "No such file or directory", then run ssh-keygen -t ed25519
to create a key.
It will ask you to enter a file to save the key, leave it blank and press enter. It will say that it created the directory /Users/<your_username>/.ssh
It will ask you to enter a passphrase, leave it blank and press enter twice to confirm.
If you've done every correctly, you should be something like this printed to your terminal:
Run cat ~/.ssh/id_ed25519.pub
in your terminal. Copy the output (starting from ssh-ed25519
and ending in .local
). You'll need it for the next step
Navigate to the homepage of Github in your browser. Go to your account settings:
Click "SSH and GPG Keys":
Click the "New SSH key" button:
Put a description title about what environment the SSH key is associated to. For example, if you are setting up a Marcy Macbook, name it something like "Marcy Macbook", or if it's your personal laptop you can name it "Personal Marcy Computer". Open the 'Key type' dropdown and select 'Authentication Key'. Paste the key in the text area and click "Add SSH key".
Go back to your repository on Github. Then, click on the Code button and make sure the pop-up has "SSH" underlined and selected. The url should start with git@github.com:...
. If this is not the case, click the link that say SSH
. Copy that URL in the text box.
Back in your code editor's terminal, make sure that you have a Unit-0
folder and that your "working directory" is your Unit-0
folder. If not, cd Unit-0
to jump into it. Clone down the project using git clone repo_ssh_url
, replacing repo_ssh_url
with the URL you copied from the previous step. If asked, "Are you sure you want to continue connecting", type yes
.
Then change directory into your project cd my-first-repo
or whatever you named your repository.
Once your repo can been cloned down, use the vsCode IDE to update the README.md
inside of your my-first-repo
project. This is not to be confused with the README.md
in the root folder of your environment. You should specifically open and edit the one in your my-first-repo
folder. Add a 3-4 sentence bio about yourself. Be sure to save the file.
Push the changes back up to Github using best practices. In the terminal, run:
Go back to Github to view your repository in the browser. Refresh the page and confirm that you see your newly added bio!
Once you have completed all the steps in these instructions, reach out to a technical instructor to verify you are finished.