35

I'm putting together some documentation and don't have access to a non-configured machine to test this myself

I'm curious if you need a GitHub account to clone a repository from GitHub to a local machine.

  • 1
    In the question title you ask "Can you clone a Github repository without an account?" but in the question you say "I'm curious if you need a Github account to clone a repository from Github to a local machine." These are logical opposites, which makes reading the answers confusing because the "No" answers seem reversed based on the title. @Stevoisiak Can you please fix it to make responses logically consistent? Maybe update the answers to be consistent based on which way you go with the title/text? – rjurney Mar 6 at 22:25
  • @rjurney I‘m not the question author, I simply made minor formatting edits. – Stevoisiak Mar 8 at 15:00
  • @Stevoisiak I get that. He's long gone. Can you fix up the question? I don't have access on Super User to do it and it is needlessly confusing. – rjurney Mar 9 at 16:21
43

No. You just use a different URL:

git clone git://github.com/SomeUser/SomeRepo.git

However, the local repo will be "read-only" in the sense that you won't be able to push your changes back to the original repo. You will still able to modify files and commit changes locally, though.

In contrast,

git clone git@github.com:UserName/OtherRepo.git

works only if you have properly set up your environment with the necessary SSH keys and whatnot, but in return you'll get a repository that permits you to commit/push the changes back to the remote repo.

(Sorry for the unintentional ad for GitHub, I just had it in mind.)

| improve this answer | |
  • Awesome, thank you for the clarification. I'm aware of the limitations by approaching a clone this way, but it's fine for the context of the process I'm documenting. – Joseph Mainwaring Feb 26 '13 at 20:29
  • @JosephMainwaring I'm glad to have helped. Please don't forget to accept my answer when you'll be able to do so. – H2CO3 Feb 26 '13 at 20:30
  • 1
    For GitLab it's git clone https://gitlab.com/SomeUser/SomeRepo.git – Matthias Braun Jun 6 '17 at 9:46
  • So in fact the answer isn't no. It is yes, but only read only via the http method. You should change the answer to indicate this. "No" sounds like you can't git clone Github repos without having a user and logging in. – rjurney Mar 6 at 21:48
  • Wait: I'm wrong. Sorry. The question is actually what is confusing. I commented there to make the required edits, I don't have the privileges here to do it. – rjurney Mar 6 at 22:41
5

I was following some documentation for a product which required cloning from github. I didn't want to bother setting up an account so I needed to do exactly what was asked here.

The command in the documentation was:

git clone git://github.com/fcrepo4/fcrepo-message-consumer.git

but that just fails for me with.

Cloning into 'fcrepo-message-consumer'...
ssh: Could not resolve hostname github.com: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

I tried

git clone git://github.com/fcrepo4/fcrepo-message-consumer.git

as suggested in one of the answers but that failed too with.

Cloning into 'fcrepo-message-consumer'...
fatal: Unable to look up github.com (port 9418) (nodename nor servname provided, or not known)

What finally worked was this:

git clone https://github.com/fcrepo4/fcrepo-message-consumer.git
| improve this answer | |
2

Or just use http prefix , and .git suffix is not mandatory too :

You can check with

git clone http://github.com/tizenteam/iotivity-example

Related info:

https://help.github.com/articles/why-is-git-always-asking-for-my-password/

| improve this answer | |
  • Anonymous download actually wouldn't work for me until I removed the .git suffix. – jhfrontz Jun 8 '18 at 14:42
0

You could use Github Tokens https://github.com/settings/tokens and use this:

git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/"

(replace ${GITHUB_TOKEN} with the actual token

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy