Cloning Repository
Last updated
Last updated
Currently, your repository is only available on github.com, but we want our repository to also be on our local computer so we can start creating and editing files.
Click the green "Code" button, and a small box will appear with three different options.
Clone with HTTPS: Every repository has its own "git URL" which ends in ".git". Using this git URL, I can "clone" my repository as a folder to my local computer, and my local computer will recognize the folder as a git repository, and I can use git commands inside of this folder.
Open with GitHub Desktop: GitHub Desktop is an application by GitHub that helps simplify pushing and pulling commits from your remote (i.e GitHub website) repository to your local computer (and vice versa).
What's nice about the application is that you do not need to use the terminal, which we will use later on.
I've shared a link to GitHub Desktop in the extra resources portion of this document.
Download ZIP: You can also download all of the files of your repository as a folder to your local computer, but your local computer would not recognize it as a repository. This option is useful if you just want the files of a public repository (that is usually not your own) and do not plan on interacting with the repository.
We will be cloning with HTTPS; copy your repository URL by clicking the clipboard button next to your unique URL.
Open up your operating system's terminal. We will use our first git command: "git clone". git clone retrieves your repository from your repository URL and clones it to your local computer. To use this command, type "git clone [paste your unique repository URL here]".
Note on the First Line (cd github_talk): as I mentioned in the beginning, cd is a command in the terminal that stands for "change directory"
I used it to move into a folder I previously created called "github_talk".
You may also want to create a designated folder for all your GitHub repositories and then use the "cd" command to change your terminal directory to that folder
When you clone your repository, your repository will appear in that directory.
Note on .gitignore file: You may have noticed our .gitignore file is not visible in our repository folder. This is something I've seen happen on the Mac, but, in my experience, this is not an issue on Linux. For Windows I'm not certain if this is a problem. Either way, files that begin with a "." may not be visible in the folder. That does not mean that the file is not there.
You may need to use a text editor such as Atom (https://atom.io/) to see and edit these files.
For Mac, you may also see a .DS_store, which are files that preserve the order of your files in Finder.
The below image is a screenshot of my Atom editor viewing the repository we've just cloned, and the .gitignore file is being displayed. As you can see, my demo repository is ready to be used on my local computer!