4

I'm having trouble trying to clone a GitHub repository with the following command:

git clone https://username@github.com/MYPROJECT.git

When I run it, I get this error:

fatal: cannot exec 'git-remote-https': Permission denied

How can I resolve it?

nivanka
  • 1,352
  • 6
  • 23
  • 36

3 Answers3

4

Try:

 git clone https://github.com/username/MYPROJECT

Which should be the correct http address (instead of trying to access github through an ssh session) for a public repo.
It will take advantage of their support for smart http.

 git clone https://username@github.com/username/project.git

is for private repo (as explained here), which should work if your id is right and your public ssh key correctly updated on your GitHub account.
(Note: your original address was missing the /username/ part)

The OP reports:

my RSA keys were not used when authenticating, I did a ssh-add and added them.
After that it worked figured it out by running ssh -vT git@github.com in my terminal

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I am using a private project, and it needs the username there too – nivanka Aug 23 '11 at 12:50
  • @nivanka: ok, then check your ssh parameters and config: http://stackoverflow.com/questions/922210/unable-to-git-push-master-to-github/922461#922461. And **don't forget the `/username/` part** (which you don't have in your question) – VonC Aug 23 '11 at 12:53
  • I don't understand. Trying to clone (no matter how) gives me that error. It is a public repository, so I should be able to clone it even without RSA key. – Domi Apr 07 '14 at 09:02
  • @Domi that was for managing the passphrase associated with the OP's private key, as he ended up using an ssh url. In your case, start by trying to clone your repo using https, and check the case (the url is case sensitive) – VonC Apr 07 '14 at 09:04
  • @VonC Its a 100% exact copy&paste of the URL, using https from github and I get that error. I use TerminalIDE on Android. Can I somehow increase verbosity to figure out what goes wrong there? – Domi Apr 07 '14 at 10:09
  • @Domi a `git clone --verbose` can help, as well as set `GIT_TRACE=2` before the `git clone`. – VonC Apr 07 '14 at 10:33
1

Every GitHub project has a 'clone url' widget to help you select the URL you need. Select it's access method (GIT/HTTP/etc.) and copy the url.

If it's your own project (/ have write access to the project):

git clone git@github.com:username/project.git

or

git clone https://username@github.com/username/project.git

If you want a readonly clone:

git clone https://github.com/username/project.git

Grad van Horck
  • 4,488
  • 1
  • 21
  • 22
  • You last one is actually a read/write address, only for public repo. The OP needs a read/write address for a private repo (which is your second one). – VonC Aug 23 '11 at 12:56
  • I don't know about privated repos, but a https without specifying a user can only be read access. In that case the server has no knowledge about the user. (just like plain HTTP) – Grad van Horck Aug 23 '11 at 13:02
  • 1
    The problem really was my RSA keys were not used when authenticating, I did a ssh-add and added them after that it worked figured it out by running `ssh -vT git@github.com` in my terminal thanks guys – nivanka Aug 23 '11 at 13:10
  • @Grad: I use your last one everyday to push to my repo. The user is specified in my `.netrc` file. http://publicfields.blogspot.com/2011/01/https-push-to-github.html. And to be sure, I have specified the `github.user` and `github.token` config entries. – VonC Aug 23 '11 at 13:16
  • But the `.netrc` config just adds the username (and password) to the request. (And then would be equal to the second line). (But it's an inventive method indeed, never thought of it...) – Grad van Horck Aug 23 '11 at 13:21
-1

Disabling the antivirus resolved this issue for me.

Lyle Z
  • 1,269
  • 10
  • 7