I'm on a machine running Windows 10, with Developer Mode enabled and the Linux Subsystem installed. When I switch into bash, I am trying to run a simple clone command from git:
git clone https://github.com/PrivateRepo/my-private-repo.git
Of course I've scrubbed the URL here a bit, but you get the idea. Initially, the response I got back from that command was this:
fatal: unable to access 'https://github.com/PrivateRepo/my-private-repo.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
I saw a few Stack Overflow answers talking about that but to be honest I don't really know the proper way to deal with that error. With that said, I know an improper way which is to just circumvent it completely, by running the following command:
git config --global http.sslverify false
And that seems to work. It's probably bad that I'm turning off all SSL verification, but I need to get this working, and it's not really the point of this question (which I'm getting to). But as an aside if you know the proper way to fix that I'm all ears.
Next, I re-ran my
git clone command, and this time it prompted me for a username and password, but utlimately ended up failing for a different reason. Here's what it looked like:
git clone https://github.com/PrivateRepo/my-private-repo.git Cloning into 'my-private-repo'... Username for 'https://github.com': myuser Password for 'https://email@example.com': remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/PrivateRepo/my-private-repo.git'
However, I can assure you that the username I typed was correct, as was the password. I also have Git for Windows installed, and when I tried it there everything worked. The only caveat was that instead of prompting me for a password in the command line, it opened a separate window to enter credentials and there it also asked me for my six-digit 2FA code. Then it cloned just fine. I noticed that in doing so it created a Personal Access Token in Github. So I went ahead and created another Personal Access Token, and tried to use it manually in bash. Basically instead of typing
myuser for the username I typed
git clone https://github.com/PrivateRepo/my-private-repo.git Cloning into 'my-private-repo'... Username for 'https://github.com': myuser:a1abcdefab2a34567ab8901a2bc3d4567890a1b2 Password for 'https://myuser:firstname.lastname@example.org': remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/PrivateRepo/my-private-repo.git'
But as you can see it still failed. How do I get git working in bash on Windows?