Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

On Windows only, operations fail using ssh with PKI #1966

Answered by stevecj
stevecj asked this question in Q&A
Discussion options

I am updating code that was previously Linux-only to support Windows, and my tests are failing on Windows with errors like

ERROR: Cmd('git') failed due to: exit code(128)
  cmdline: git clone -v -- ssh://<redacted> C:\Users\stevjorg\AppData\Local\Temp\clitest-qevu7qrx
  stderr: 'Cloning into 'C:\Users\stevjorg\AppData\Local\Temp\clitest-qevu7qrx'...
Permission denied, please try again.
Permission denied, please try again.
<redacted>: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I can successfully execute the same command that is shown for "cmdline:" manually at the Windows command prompt.

The connection uses ssh keys, so no password is used/needed.

Any ideas?

You must be logged in to vote

I finally figured out the problem. I was running this through WinPython, and its batch files that set the environment prior to running python.exe assign a value to HOME (that is not the current user's home directory). Apparently, that confuses ssh because when I tweaked my process for starting python.exe in WinPython to clear the HOME variable, that fixed the problem.

…so the problem has nothing to do with GitPython, but others attempting to use GitPython under WinPython will likely encounter the same problem.

My specific fix was to stop using WinPython's scripts/python.bat to run Python and to instead call its scripts/env.bat to set up the environment, then SET HOME=, then execute if not…

Replies: 2 comments

Comment options

It looks like SSH is refusing to work in the environment that the tests are executed in, hence it can't authenticate and the clone fails.
It might be related to environment variables not being passed through to GitPython, which I'd think doesn't limit the environment of child-processes. However, this is something you could verify in cmd.py.

You must be logged in to vote
0 replies
Comment options

I finally figured out the problem. I was running this through WinPython, and its batch files that set the environment prior to running python.exe assign a value to HOME (that is not the current user's home directory). Apparently, that confuses ssh because when I tweaked my process for starting python.exe in WinPython to clear the HOME variable, that fixed the problem.

…so the problem has nothing to do with GitPython, but others attempting to use GitPython under WinPython will likely encounter the same problem.

My specific fix was to stop using WinPython's scripts/python.bat to run Python and to instead call its scripts/env.bat to set up the environment, then SET HOME=, then execute if not "%WINPYWORKDIR%"=="%WINPYWORKDIR1%" cd %WINPYWORKDIR1% followed by "%WINPYDIR%\python.exe" %* as scripts/python.bat would do.

You must be logged in to vote
0 replies
Answer selected by stevecj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1964 on October 04, 2024 05:10.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.