Git clone with PAT is failing

I’m trying to clone one of my private repositories on a new machine (linux subsystem on my windows machine). My git client is 2.25.1. My PAT works on my mac machine.

On my linux subsystem I run:

PROMPT> git clone https://github.com/bkushigian/dotfiles
Cloning into 'dotfiles'...
Username for 'https://github.com': bkushigian
Password for 'https://bkushigian@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/bkushigian/dotfiles/'

Now I can’t see what I’m pasting into the password field because it’s hidden, but I’ve tried pasting to terminal and it works. I’ve also tried a few other solutions, like using arguments

git -c http.extraheader="AUTHORIZATION: Basic $(echo "bkushigian:ghp_MY-PERSONAL-ACCESS-TOKEN"|base64)" clone https://github.com/bkushigian/dotfiles

and

git clone https://bkushigian:ghp_MY-PERSONAL-ACCESS-TOKEN@github.com/bkushigian/dotfiles.git

but I keep getting denied access.

Shouldn’t this ‘just work’? Are there special hoops I have to jump through?

Followup: I created a new PAT and it worked. Is this what I’m supposed to do? From what I read it seemed like PATs are supposed to be 1-per-user, and I’m the same user (same git config file, etc).

PATs should work regardless of which machine you’re on. I obviously can’t check, but my guess is that there was some issue with copying it, maybe an extra space or linebreak or something.

1 Like