About 1.5 hour
GitHub is a widely-used code storage and code collaboration tool. In this lesson we cover the storage aspects of GitHub. In another lesson, we’ll cover the collaboration aspects of GitHub.
Participants will be able to
GitHub for Code Storage (video walkthrough of slides)
Learn how to create a ‘gist’ here. You will soon be required to turn many things in with a gist. (Note: It’s super easy.)
“The Git repo on my laptop is the same thing as the GitHub repo.” The Git repo you may have for a particular project on your laptop gets attached to the GitHub repo you set up to store all it’s code in. The changes you make in your Git repo on your laptop won’t transfer over to your GitHub repo until you run the git push -u origin main
command.
“I can only push perfect and polished code to GitHub.” Lots of people use GitHub to showcase finished projects, but lots of people also use GitHub to store their projects-in-progress. Your code does not need to be perfect, especially as a junior software engineer. If you are really worried about people seeing your code before you deem it “ready”, consider upgrading from a free account to the lowest-tier paid plan (currently $7/mo), which allows you to have an unlimited number of private repos. All Techtonica assignments must be pushed to public repos, however.
“I just cloned this repo from my own account! Why won’t it let me git push?”
When you git clone github.com/some-name/some-repository
, a folder with the name of some-repository
will be downloaded to the current directory, and it will already have the remote origin set up as that url. But you are still in the parent folder; now enter cd some-repository
to start working with your cloned project.
If you are having a problem pushing up to the remote and getting weird errors like “there is no remote called ‘origin’“, odds are that you are not in your new some-repository
folder where the git data is. Make sure that when you enter pwd
(present working directory), it prints that you are definitely in some-folder
before ruling out this problem. I still make this mistake sometimes!
In the video walkthrough, the instructor demonstrates the proper GitHub workflow for creating and pushing to repos.
Techtonica staff will assign pairs. With your pair, go through the demonstration in the video walkthrough with a new project (not the one you started in the “Git & Version Control” lesson).
The group will tell the instructor, or a fellow classmate, how to get through the GitHub workflow presented in this lesson. This should be done from memory, and the instructor or classmate will work on a computer attached to the projector.
Work through this Git and GitHub tutorial for Beginners, which reinforces all of the concepts we covered in this lesson, plus some more advanced topics such as branching, merging and pull requests. Fun!
Form small groups and discuss: