Today’s post is wrapping up the Connecting Your Computer with GitHub lesson with the final Skillcrush. At the end of this lesson, Skillcrush challenges students to take what they have learned and apply all of it together. In this challenge, you will use forking, cloning, and pushing on another repository on GitHub.
Skillcrush has a repository students can use to practice forking, cloning, and pushing. You can find this project at github.com/skillcrush/105-project. However, you can use a different repository if you like.
Step One: Always make sure you are on GitHub and are logged in. Take time to find the repository you want to use if you don’t want to use the Skillcrush one. Once you have found a repository, look for the fork button and click it (hint: look at the top right corner).
The pop up window should appear. Look at all the options and make sure the “copy the main branch only” is checked. Click the button that says Create Fork when you are ready.
Note: Some repositories will give a message after you click the Create Fork button that asks where you want the forked repository to go. If you get this message, make sure you pick the option with your username.
Step Two: When your forked repository is copied into your GitHub account, make sure you are on the repository copy you just made. Click the green Code button when you are ready for the next step. You’ll get a pop-up window with the local and codespace tabs inside to appear.
Make sure you are on the local tab, then look for the SSH address. Click the clipboard icon to copy this address. This will start with git@github.com followed by your username
If you aren’t seeing the ssh address, double-check the SSH link is checked. Once you’ved copied the link, we’re ready to move to the command line open.
Step Three: Go to your home directory in the command line. Use the cd and pwd commands to help you find the right one. Type git clone then paste the SSH address you just copied from GitHub.
Press Enter when you are ready. I get asked for a passphrase on my computer often, so if you get this message, just type in your passphrase. Press Enter again, and the command line will show updates as the computer clones the repository.
The clone is completed when you get a message saying “Receiving objects: 100%” on the command line. Double-check using the ls command if you aren’t sure if it is in your directory.
Step Four: Go into the project directory. Skillcrush students would move into the 105-project directory. Use the cd command to move into the right directory.
Don’t forget to use the pwd command if you aren’t sure where you are. When you are in the right directory, open the directory. Your computer has different commands you can use to open a directory. Use the one that best fits your computer.
- PC: explorer . or start .
- Mac: open .
Step Five: When your directory is open, make changes to a file. Skillcrush students would right-click or control-click the index.html file that is inside to preview it in the web browser. If you are using a different repository file, you will want to see a preview of that project’s site with its index.html if there is one.
After you look at the preview, go and make changes to the index.html file. Skillcrush students would open the 105-project folder in the text editor and make changes to the index.html file. These changes could be changing a headline, tagline, or images.
When you are done making changes, save your code. Make sure you refresh your browser window to see the changes you made and were saved.
Step Six: Go back to the command line. Run the git status command. You will see it is under version control since the project is cloned directly from GitHub.
Once you see that the changes are ready to be added to staging, run the git add command on the file you made changes to. Don’t be afraid to run the git status command again to make sure the changes have been added.
Step Seven: Next, commit those changes. Use the git commit command and write a commit message. Keep this message as clear and concise as much as you can.
Step Eight: Push your changes to the remote repository on GitHub. Use the git push command to move your changes. If you get asked for your passphrase, type the one you made and press Enter.
Go to GitHub and find the repository you are using for this challenge. Click the commits section. This section will have your latest commit now.
You can click on the commit message. The commit message will break down all the changes you have made.
Conclusion
This post marks the end of the Connect Your Computer with GitHub lesson. Now you have your computer connected to GitHub. You have also learned how to fork, clone, and push repositories on GitHub.
The next lesson in Skillcrush 105 is The Branding Workflow. This lesson is about how branches work in repositories and what git commands you need to create one. At the end of this lesson, you’ll be able to create your first branch on a repository.
Top comments (0)