简体   繁体   中英

Linux git clone issue - prompting for password

I'm having a problem simply cloning a VSTS (Azure DevOps) git repository on my newly set up PopOS Linux machine. I'm using VSTS PATs (Personal Access Tokens).

The Issue

The following statement from the command line prompts me for a password, which it should not:

git clone https://personalAccessToken@company.visualstudio.com/blah/_git/blah

The response from the command line is:

Password for 'https://personalAccessToken@company.visualstudio.com':

If you're familiar with PATs in VSTS, this should not prompt for a password - it should just clone the repo. On Windows, this works. On my other Linux machine running Elementary OS, this works. It just doesn't work in PopOS Linux for some reason.

Other Details

  • I do not wish to use SSH
  • I do not wish to use Alternate Credentials (although I tried this method as well and it always says 'authentication failed').
  • I can successfully clone https repos that do NOT have authentication.
  • I have tried a couple different VSTS repos, so we can rule that out.
  • I have tried with several different PATs.
  • As mentioned, this works flawlessly in other distros and on Windows using the same PAT/url.
  • I'm not using any sort of a proxy.
  • And yes, I hate the name PopOS as much as everyone else, but enjoy the distro.

I don't know how you've managed to do:

git clone https://personalAccessToken@company.visualstudio.com/blah/_git/blah 

When you do that you're passing the PAT as HTTP Basic username, which is incorrect and shouldn't have worked with any sane version of git.

To use PAT with git, you need to pass the PAT as HTTP Basic password, and you can use any username as it's ignored. So the correct remote url syntax should be:

git clone https://git:personalAccessToken@company.visualstudio.com/blah/_git/blah 

or perhaps even:

git clone https://:personalAccessToken@company.visualstudio.com/blah/_git/blah 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM