Forking and cloning a project from GitHub is a way to copy all the code and files from someone elses project onto your own machine. For some reason, I never remember the steps to do this.
I’m not sure how many times I have watched this video or WHY it doesn’t stay in my head, but just in case I can’t find it one day, I’m posting it here…
- Navigate to the appropriate GitHub Project
- Click on the Fork Button – this creates a fork in your own repository
- Copy the SSH or HTML address (More info later on the difference)
- Open up your terminal and make sure you are in the appropriate directory for your project
- Then you need to type this (replace the URI with whatever the one you have is).
$ git clone https://github.com/tracymu/arrays_and_active_record.git
And that’s it!
GitHub has mystified me a lot, so now and then I try to understand it better. Here I found a good resource, and while some of it is still a bit beyond me, I appreciated the description here of the basic Git workflow:
git initwill create an empty Git repository in the current directory or a directory you specify. If you want to work on an existing repository that lives at a remote location, use
- To make sure you have the latest version of the repository (if you cloned from a remote, upstream location), use
- After adding new files or making changes to existing ones, add your changes with
- Commit and describe your changes with
git pushto send your changes to a remote location, such as GitHub.
I’m still a beginner, so let me know of any tips or resources you have with regard to GitHub.