3

I need to install a package using pip via Git.

The password of the repo contains @.

According to Git clone with password @, I tried the following:

pip install git+http://user:xxxx%40xxxx@url...

Which threw:

fatal: Authentication failed for

Same with:

   pip install git+http://user:xxxx@xxxx@url...
   pip install git+http://user:'xxxx@xxxx'@url...

How can I install a package using pip via git+http giving the credentials directly to command line when the password contains @ in sh ?


Edit:

To make it clear: I am NOT using Github but TFS17 and I have NO OTHER CHOICE but provide username and password inside the URL.

Itération 122442
  • 2,644
  • 2
  • 27
  • 73
  • `pip install git+https://@github.com//.git` source: https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token – dejanualex May 31 '21 at 09:20
  • That reminds me of https://stackoverflow.com/q/51245733/6309... which also had no answer. – VonC May 31 '21 at 09:27
  • Can you locally clone the repo and then pip install using the files directly ? – Thibault D. May 31 '21 at 09:31
  • @pLOPeGG I could, but I am still facing the same issue with the `@` character. – Itération 122442 May 31 '21 at 09:36
  • just throwing it out there, maybe `export PASS="123@456" && pip install git+http://user:$PASS@url...` will work? pip uses your shell for git so maybe using env vars will fix all the escaping issues – Ron Serruya May 31 '21 at 09:52
  • @Ron Quoting helps when the string needs to be protected from the shell, but the error message here does not come from the shell, as far as I can tell. – tripleee May 31 '21 at 09:56
  • @RonSerruya Unfortunately the password is already in an env variable :( – Itération 122442 May 31 '21 at 09:59
  • 1
    @FlorianCastelain you mean that you can't even clone the repo with a git command ? Then this is not only a pip problem but TFS17 I guess. – Thibault D. May 31 '21 at 10:31
  • 3
    Definitely take `pip` itself out of the equation first: get to the point where you can run `git clone` successfully even in some fully automated setup. Then re-introduce pip and figure out how to make sure pip invokes git with the method that works when fully automated. – torek May 31 '21 at 12:28

0 Answers0