user1191
user1191

Reputation: 221

What I need to do to make a clone of github repo

I am new to git and gitub.

I created a new public repository on github for a project following the guideline at

http://help.github.com/create-a-repo/

after some steps I used the following commands:

git add .
git commit -m 'first ever commit'
git push origin master

Now I am able to get a zip file from that repo using the github zip feature and that works fine, I can see all my project files after unzip that zip file.

But now I want to get a clone of that repo. What do I need to do now to get a clone? Do I need to create another branch or fork before I can do clone command on my local pc to get a clone of that repo?

After these 2 answers I am still confused. I do not mean to make a clone of my local project. I mean to make a clone of remote public github repo by any one with Internet connection.

Upvotes: 4

Views: 9772

Answers (2)

Justin Thomas
Justin Thomas

Reputation: 5848

Why would you want a clone a local repo? It's already there! The point of clone is to get a copy of a remote repo. Git, unlike other source controls, works locally for commiting/branching etc.

git basically works like this:

Instead of having a repo on a server and a copy on the client you have multiple repositories in which you need to be aware.

You have your local repository.
You have a local copy of the remote repository.
You (possibly) have a remote repository.

The command git add tells git you want want to add it to source control.
The command git commit tells git you want to add it to your local repository.
The command git fetch tells git you want to sync your local copy of the remote (origin/master for instance)
The command git push tells git you want to take your local repository and push that to a remote.
The command git merge tells git you want to merge your local repository with your local copy of the remote branch (or any other branch for that matter).

In your case git init just creates your local and the remote stuff doesn't matter, but when using github or your own remote servers it does. git clone creates your local repo and your local copy of the remote repo in question.

Upvotes: 2

wkl
wkl

Reputation: 80031

Take a look at a project like hubot: https://github.com/github/hubot. See the HTTP or "Git read-only" buttons at the top? That tells you the URL to use to clone the repo. So cloning hubot via HTTP, for example would be:

git clone https://github.com/github/hubot.git

Your project page will have the same thing, but in general it will be:

git clone https://github.com/[YOUR USER NAME]/[PROJECT NAME].git

I should add you can also do an SSH checkout, but it will be different. Look at Fork A Repo

git clone [email protected]:[USER NAME]/[PROJECT NAME].git

Upvotes: 4

Related Questions