-1

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

  • 1
    Do you by chance have multiple github accounts? Is there an authentication prompt when running `git clone ...`? – MaartenDev Nov 06 '21 at 18:10
  • 4
    GitHub no longer permits https with password. Use ssh. – matt Nov 06 '21 at 18:11
  • No does'nt ask me for username password @MaartenDev. I'm gonna try as Matt said using ssh Thanks so match both – Héctor Cervera Panella Nov 06 '21 at 18:25
  • Thanks mates. I didn't knew how to work with SSH Keys, but after learning works like a charm. Really appreciated. – Héctor Cervera Panella Nov 06 '21 at 19:27
  • 1
    Yes, it's probably the case that you have an inappropriate cached credential for https in whatever credential helper you have installed and have told Git to use. The GitHub Desktop software doesn't use that credential helper, so doesn't have the problem. You could clear out the cached credential, after you figure out what's caching it, but I prefer ssh access anyway, it tends to be a lot more reliable. :-) – torek Nov 07 '21 at 03:42

2 Answers2

1

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

vegan_meat
  • 878
  • 4
  • 10
1

SSH creation with Git bash: That worked for me

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

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 git@github.com:xxxx1/xxxx2.git
  • cd [name_of_repo_cloned_folder]
  • git checkout develop