GitPython icon indicating copy to clipboard operation
GitPython copied to clipboard

Problem authenticating through Active Directory

Open lossurdo opened this issue 5 years ago • 1 comments

My company authenticates its Azure DevOps git repositories on Windows Active Directory. So I have to add domain name to correctly authenticate and clone repositories.

Like this:

test = "https://domain\\user:[email protected]/tfs/.../my_repo"
repo = git.Repo.clone_from(test, temp_dir, env={"GIT_SSL_NO_VERIFY": "1"},
                           branch='master', depth=1)

And I got this error:

fatal: unable to access 'https://domain/user:[email protected]/tfs/.../my_repo/': Empty reply from server

Notice that the backslash right after the domain has been replaced by a slash. Probably the problem is related to this function python cmd.polish_url() and this line [327] url = url.replace("\\\\", "\\").replace("\\", "/").

My environment is:

  • gitpython-3.1.7
  • Python 3.8.2 - Windows 10 64bits

Thank you in advance.

lossurdo avatar Aug 19 '20 17:08 lossurdo

GitPython handles URLs absolutely incorrectly, and it feels like hack on hack just to fix one particular problem.

In that tradition… :D … and after having read the comment I think this code exists to handle paths in particular, like c:\git-repo.

In order not to break that, we could check if a scheme is present and if so, assume a valid URL. If some other problem surfaces from that, I guess that will be fixed separately.

Please feel free to submit a PR for this kind of solution to get this problem fixed soon. Thank you

Byron avatar Aug 20 '20 04:08 Byron