Reputation: 10022
It has been a little time since I did my last cloning from a repository. My situation is the following:
There is a repository in github that I want to clone into my local system. I go to the github page and there are two options for cloning: download as a zip file or open with github desktop. Let's put the github desktop aside for a while.
Now, there is another option for cloning. I go to my terminal and do git clone <address of the repository>
In both cases I do get a copy of the repository on my local system successfully but it is not a git repository (Of course I can do git init
to make it one but I am not sure it is the correct procedure-therefore this question)
Of course there is no origin that link this local copy to the github repository. My goal is to have a local copy that I can pull frequently so that I can always have an actualized version of.
So my question is what is the correct procedure to clone a github repository to my local system so that I can be linked to it and can frequently pull to?
Upvotes: 0
Views: 103
Reputation: 155648
The "Download ZIP" option does not download a clone, instead it only downloads the latest commit without any history (i.e. there is no .git
directory inside of it).
what is the correct procedure to clone a github repository to my local system so that I can be linked to it and can frequently pull to?
Use your terminal and run git clone <address>
- it will be a git repository and it will have GitHub set up as a remote (as origin
). Don't forget to cd
into the clone directory after it's created in order for the git
command-line to work on that repo.
It's likely you can't see the .git
directory because you have "Show hidden (dot-prefixed) files" disabled - you'll see it if you run ls -al
to show all files.
You will see the remotes by running git remote -v
- but only if you cd
into the newly created repo directory.
Upvotes: 4