About 1.5 hour
- 45 minutes for the Lesson
- 30 minutes for Independent Practice
- 15 minutes for Group Practice
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
- Explain the difference between Git and GitHub
- Create their own GitHub account
- Push code from their local machine to GitHub
- Identify what should be included in a README
- Create a new GitHub repository
- Link a GitHub repo to a Git repo on your local machine
- Push a project from your local machine to its respective GitHub repo
- What makes an effective README
-
GitHub for Code Storage (video walkthrough of slides)
- Please watch the video the first time without working along with the demonstration. Jus absorb the concepts. Then, you can watch the demonstration a second time and code with the instructor if you like.
-
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.)
-
Use this README.md template to get started. At this point, if you don't have something for a topic like "Tests", just leave it out. Make sure to add a screenshot right after your project description if you have something visual coded up. If you're not sure how to add a photo to a markdown file, check out this markdown cheatsheet.
-
"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 master
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 ofsome-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 entercd 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 enterpwd
(present working directory), it prints that you are definitely insome-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!
2 days after presenting this lesson, have participants go through the workflow again individually by creating a new project locally and pushing it to GitHub. They can use any resource except the slides and video walkthrough. They should email the instructor a copy of their Terminal session.