1

I've created a private repo in Github. But when i perform git fetch, it shows me an error of 'remote: Repository not found. fatal: repository not found.' I am a collaborator and an owner of the repo in GitHub. I'm new to GitHub and have no idea what I can do to solve this issue. Any help is appreciated. Thank you

I've tried git remote add origin. When I type in `git remote, it shows me 'origin'.

haloPri
  • 11
  • 1

2 Answers2

1

This type of question should really be posted on SuperUser instead. But, since it's here, I'll respond here.

I'm assuming you've cloned the repository locally to your machine. If not, do git clone <repo URL>.

Further, git can't see private repos unless you have a public ssh key added to your Github account and the corresponding private key is on the machine that you're issuing the git fetch command.

To generate an ssh key, simply run ssh-keygen from a terminal in any directory. Accept the default location for the key and supply a passphrase if you wish. Then, copy the contents of the resulting id_rsa.pub. On Github, go to your "Settings" and go to "SSH and GPG keys". Then click "Add SSH key" and paste the public key contents there. Once you've added it to Github, git will be able to see your private repos.

fireshadow52
  • 6,298
  • 2
  • 30
  • 46
  • Thank you for the reply but even when i do git clone, the same error appears saying remote: Repository not found. When I did git remote add origin however, it shows "error: remote origin already exists." Hence why I'm confused – haloPri Apr 07 '23 at 05:50
  • @haloPri Have you added an SSH key to your account? – fireshadow52 Apr 07 '23 at 06:12
  • yep I tried adding SSH key but still no difference. – haloPri Apr 07 '23 at 06:53
  • @haloPri See if the answers to [this question](https://stackoverflow.com/questions/32238616/git-push-fatal-origin-does-not-appear-to-be-a-git-repository-fatal-could-n?rq=1) get you in the right direction... – fireshadow52 Apr 07 '23 at 11:39
1

Try git remote add origin <URL> per the git remote examples

  • Hi there, I've done this but it shows me "error: remote origin already exists.". But when i try to even do git clone, it shows me remote: Repository not found. – haloPri Apr 07 '23 at 05:53
  • do `git remote rm origin` and then `git remote add ` – Tanner Firl Apr 08 '23 at 01:28