Learning How to Git: Cloning Your Repository
Let’s say you are working on your project with your partner. And your partner is the one who start the project or you are going to continue your project on a different PC. You already have the git repository link for the project, so what now? What you need to do is to clone the repository.
Which URL to Use?
It is pretty easy, all you need to do is to navigate to the repository project page and look for some URL in a text box or a clone download. The structure would be something like git@name-of-git-host:username/project-name
(SSH version) or https://name-of-git-host/username/project-name
(HTTPS version).
Something to keep in mind is that if you want to use the SSH version, you will need to add SSH key for the respective PC to the Git host setting. If you still not sure how you can check the link below.
Cloning The Repository
To actually cloning the repository, you will only need to use git clone <url>
. Pretty easy right? So, here’s an example of me trying to clone my learning how to git repository.
So, as we can see from above picture is that we actually have successfully cloning our repository. Cloning repository doesn’t restrict to your own repositories. You can also clone any repository from public repositories. The problem is that do you have any access if you want to push some commits to the repositories? That will be the time that the Git will restrict you to do some action for repositories you don’t have the permission to.
Wrap Up
Yeah I know yesterday I’m planning to write about branches. To be honest I don’t have much time today so I’m thinking that it would be easier for me to write about cloning repository first. Hopefully, it’s useful for you and thanks for reading.