2

I want to clone a repository and I ran into permission issues, I tried to set up my username and email but keep getting errors

I used

git config --global user.name "yusuf-uthman"
git config --global user.email "yusufuthman57@gmail.com"

but didnt get any notification wether its accepted or not.

Uthman@DESKTOP-30QGK3L MINGW64 ~/Desktop/Scripts/hng_internship5.0
$ git config --global user.name "Uthman Yusuf"

Uthman@DESKTOP-30QGK3L MINGW64 ~/Desktop/Scripts/hng_internship5.0
$ git config --global user.email "yusufuthman57@gmail.com"

Uthman@DESKTOP-30QGK3L MINGW64 ~/Desktop/Scripts/hng_internship5.0
$ git clone git@github.com:yusuf-uthman/hng-internship.git
Cloning into 'hng-internship'...
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

How do I clone the repository without getting the error?

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
Uthman
  • 31
  • 1
  • 1
  • 4
  • 1
    Seems like a permission issue. https://stackoverflow.com/questions/2643502/how-to-solve-permission-denied-publickey-error-when-using-git – Mebin Joe Apr 01 '19 at 07:29
  • 2
    Possible duplicate of [How to solve Permission denied (publickey) error when using Git?](https://stackoverflow.com/questions/2643502/how-to-solve-permission-denied-publickey-error-when-using-git) – Chris Maes Apr 01 '19 at 07:30

2 Answers2

2

The failure comes from cloning your GitHub repo via SSH URLs. To use that process, one needs to add your public SSH key in your repository.

Instead use HTTP URL method to clone which will most likely circumvent that error.

Use:

  • HTTP URLs: https://github.com/yusuf-uthman/hng-internship.git

instead of:

  • SSH URLs: git clone git@github.com:yusuf-uthman/hng-internship.git
ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
Oli
  • 651
  • 8
  • 17
  • This answer worked for me. I was using SSH cloning link instead of HTTP , the moment I tried http url it worked immediately.. Thanks and apologies for the late reply – Uthman Apr 29 '19 at 22:30
  • @Uthman if this answered your question, then upvote it, but more importantly mark it as the answer so others know it was successful to you. – ΩmegaMan Dec 22 '22 at 16:50
0

but didnt get any notification wether its accepted or not.

Username and Email are just settings in you git config file, no one will accept or decline it. If you commit, the value of the settings will be used to determine the commits author and committer.

Access rights to a repository are usually managed via ssh keys. See Connecting to GitHub with SSH.

kowsky
  • 12,647
  • 2
  • 28
  • 41