1

I am trying to git clone a private repo, but it is returning

repository not found

I put the url in chrome and it does lead me to the repository. I tried to do

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

which did not work either.

I have two different github accounts, and this is my first time using the other account for a new project. I wonder whether it has something to do with this.

penny
  • 215
  • 1
  • 9
  • But you do have access to the repo, right? Then I think you have to use the right credentials when you try to clone. I would try using ssh keys (and ssh url to the repo, of course). – eftshift0 Jun 19 '20 at 21:52
  • It might be authentication issue. – majidarif Jun 19 '20 at 21:52
  • Yes, I do have access to the repo and I suspect something goes wrong with authentication too. But I tired git clone ```https://username@github.com/reponmae``` and it still did not work. – penny Jun 19 '20 at 22:39
  • Tried using SSH key and it did work. I wonder whether there is simpler ways to solve this. – penny Jun 19 '20 at 22:46

2 Answers2

1

Considering you have two different GitHub accounts, you could place your username/password in the URL, e.g

git clone https://username:password@github.com/username/repository.git

Also, there is a huge discussion about it here.

NOTE: If you are facing error because your password contains special characters, you could "encode" it.

E.g. Let's assume your password is password! so, after encoding it will become password%21. You could do it in this website url-encode-decode.com

Willian
  • 3,011
  • 1
  • 15
  • 38
  • 1
    Thank you for answering. I tried this method as well, my command reads: But my password contains a ```!```, and it seems that it cannot recognize that. – penny Jun 20 '20 at 15:24
  • If your password contains special characters, you could encode it. I've update my answer and added the explanation on how to do it. Could you try it and let me know? – Willian Jun 20 '20 at 22:23
0

This article can probably help you: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository.

Looks like you have use this command: git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY

Strat5
  • 13
  • 1
  • 6