GitHub URL Tutorial
A Git repository is of very little use if it resides entirely on your remote GitHub or GitLab account. To actually work with the various files and resources stored in that repository, you need to pull or clone that code from the remote repo to your local machine. And to do that, you need to find the GitHub URL and use it.
To use a GitHub URL, follow these steps:
- On the GitHub website, click on you repository of interest.
- Locate the green button named Code and click on it. The GitHub URL will appear.
- Copy the GitHub URL.
- Open a Git client such as the BASH shell or GitHub Desktop on your local machine.
- Use the GitHub URL to clone the remote repo.
Once the remote repository is cloned, you can pretty much forget about the GitHub URL. Git saves the URL for you, so all future push and pull commands will know which remote repo to to interact with.
GitHub URL examples
For most clone operations, the HTTPS based GitHub URL is all that is needed. That is the one that is shown by default on the repository page. But it actually comes in three flavors: HTTPS, SSL and GitHub CLI.
|Git with SSH Keys Tutorials|
Need to configure SSH Keys for GitHub, GitLab, BitBucket or CodeDeploy? These Git SSH Key examples will help:
Follow these tutorials and you’ll learn to Git over SSH fast.
Here’s what the three GitHub URLs look like if you were to copy each of them:
gh repo clone cameronmcnz/rock-paper-scissors
Clone with the GitHub URL
With the GitHub URL in hand, the clone operation is relatively simple. Sometimes Windows developers are reluctant to open up the BASH shell that comes pre-packaged with a Git installation, but it’s really worth overcoming that fear with Git. Here’s the command you would use in BASH to clone the GitHub repository referenced by the HTTPS GitHub URL above:
git clone https://github.com/cameronmcnz/rock-paper-scissors.git
When that Git clone command executes, the GitHub URL will be used to copy all of the remote files, along with the entire commit history, to the local developer machine. From there, a developer can perform as many local commits, fetch and push operations as they need.
And that’s how you find and use the GitHub URL.