In this tutorial, we will walk you through creating your own GitHub account, creating a private repository (so your code won't be publicly visible on the web), and cloning and pushing content to your private, online repository.
Note: You should never create a public repository for work that you are doing for a class.
As students, you receive free access to GitHub Pro while you a student. To set up your account:
- Click Here
- Click on "Yes, I'm a Student"
- Fill out the form and submit for review
- Wait on email confirmation from GitHub. Hopefully, this will take less than a day.
Before you can push and pull to private repositories hosted on GitHub from your Nike account, you will need to create an SSH public/private key pair on Nike. This will allow you to give a public key to GitHub (think of it as a padlock) that GitHub can use to authenticate your requests in addition to or in lieu of your GitHub username and password. It's sufficient to think of this key-based authentication process as you unlocking the public key (i.e., the padlock) using your private key -- the Git program will do this with GitHub so long as the key pair is setup correctly.
-
Login to Nike.
-
Execute the command below, replacing
your_email@uga.edu
with your@uga.edu
email address. Do NOT change any values when prompted -- simply press return until the command is finished executing.$ ssh-keygen -t rsa -b 4096 -C "your_email@uga.edu"
This creates a public / private key pair in the default location:
~/.ssh/
. -
View your public key using
cat
and copy its output to your clipboard (usually by selecting the text in your terminal, then right clicking on the selection and clicking "Copy"):$ cat ~/.ssh/id_rsa.pub
-
Login to GitHub.
-
In the upper-right corner of any page, click your profile photo, then click Settings.
-
In the user settings sidebar, click SSH and GPG keys.
-
Click New SSH key or Add SSH key.
-
In the "Title" field, add a descriptive label for the new key. For example, if you're adding a key for your Nike account, then you might call this key "Nike".
-
Paste your key into the "Key" field. This should be the copied output from your prior call to
cat
. -
Click Add SSH key.
-
If prompted, confirm your GitHub password.
- Login to GitHub
- Click on "New" under the repositories section on the left-hand side of the page.
- You should see a screen similar to the image below. Type
cs1302-testRepo
as the name of your repository, click the "private" radio button and then press the "Create Repository" button.
-
Once you've clicked the "Create Repository" button, your repository is created but still needs to be setup. GitHub should be showing a website which gives you a few options on how to setup your repository. Instead of following those instructions directly, we will setup our repository from Nike using the following commands:
- Clone your repository on nike using
git clone git@github.com:username/cs1302-testRepo.git
replacingusername
with your GitHub username. You may get a message saying you've cloned an empty repository. That's okay! You should now have a folder calledcs1302-testRepo
. - Change into the
cs1302-testRepo
directory. - Create an initial
README
file usingecho "# cs1302-testRepo" >> README.md
. - Add your
README
file to the repository usinggit add README.md
. - Commit your changes using `git commit -am "first commit".
- Push your changes to GitHub using
git push origin master
- Refresh your GitHub page to see the changes to the repository. Your repository should
look similar to the below image. Note the number of commits (1 so far) to this
repository, the latest commit time, and the contents of the
README
file are all shown onGitHub
.
- Clone your repository on nike using
- Now that your repository is set up, let's get some more pracice. On Nike, do the following:
- Open your
README.md
file. - Type a few additional sentences.
- Commit your changes locally.
- Push your changes to GitHub.
- Refresh the GitHub page to make sure your changes have been added to the online repository.
- Delete the entire
cs1302-testRepo
folder from Nike. - Wait. Delete my entire project from Nike?!? Yep, do it.
- Execute the
git clone
command from above. And it's back! - Note: you could clone from any machine that has
git
installed. You've all been cloning cs1302 GitHub repositories all semester.
- Open your
Congratulations on becoming a member of GitHub!
Copyright © Michael E. Cotterell, Brad Barnes, and the University of Georgia. This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License to students and the public. The content and opinions expressed on this Web page do not necessarily reflect the views of nor are they endorsed by the University of Georgia or the University System of Georgia.