Home > other >  git clone doesn't find the remote repo
git clone doesn't find the remote repo

Time:11-07

I'm trying to clone a GitHub private repo. I've access to it

So what i do is (HTTPS)

git clone https://github.com/xxxx1/xxxx2.git 

When i do that i receive:

Cloning into 'xxxx2'...
remote: Repository not found.
fatal: repository 'https://github.com/xxxx1/xxxx2.git/' not found

First thing that looks weird for me is the extra "/" at the end, but i don't think that's the problem.

The only way i can do the git clone is via GitHub Desktop App, by URL.

On git status

$ git status
On branch develop
Your branch is up to date with 'origin/develop'.

On git fetch

$ git fetch
remote: Repository not found.
fatal: repository 'https://github.com/xxxx1/xxxx2.git/' not found

So the question is, what i'm doing wrong to be unable to clone the repo trough git bash?

Thanks so much

CodePudding user response:

If you are using two factor authorization (2FA) for your Github account then just use SSH option for cloning your repository:

enter image description here

CodePudding user response:

SSH creation with Git bash: That worked for me

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Enter file in which to save the key (/c/Users/xxxx/.ssh/id_rsa):

Press enter

Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

Press enter

$ cd .ssh
$ ls

Received

id_rsa  id_rsa.pub  known_hosts
  • First one is our private key (don’t share it to anyone)

  • Second one is our public key

    $ cat id_rsa.pub

    ssh-rsa […]

On GitHub go to your user picture:

  • Settings
  • SSH and GPG Keys
  • New SSH Key:
  • Title: [Empty]
  • Value: Our public key
  • Click on: Add new SSH Key

On Git bash:

  • cd ..
  • cd Documents
  • git clone [email protected]:xxxx1/xxxx2.git
  • cd [name_of_repo_cloned_folder]
  • git checkout develop
  • Related