-
-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git.Repo.clone_from() not working correctly in WSL #1902
Comments
Thanks for reporting. Even though I couldn't reproduce it, I wouldn't be surprised if something is going wrong here. It might be that it doesn't recognise the path as absolute, and makes it absolute by pre-pending the CWD all by itself (which it shouldn't have to do at all). |
Indeed with relative paths it looks like it is working correctly, but still it would be nice if it worked correctly with absolute paths as well. In my project I think I will be able to get around this issue, but if I have time I will look into your repo and propose some changes! |
I don't know if a bug is involved here or not, but this does not look like a bug in GitPython's handling of WSL paths, though even that I cannot be sure of. This may relate to problems using the I have tried running your script, as well as several manual variations, in WSL 2 (Ubuntu 22.04 LTS) in Windows 10, using Python 3.11 and GitPython 3.1.40 as in your description. I am not able to produce anything like this. When I run it, as well as when I perform the clones and variations on them manually in the Python REPL, both clones succeed. No exception is raised, and no traceback is printed for either. Although not stipulated in the description here, I did make sure to run it in a subdirectory of my Windows home (user profile) directory accessed through For me, the first clone succeeds and creates the intended cloned The second clone, which uses Due to a combination of how the demonstration code concatenates both tracebacks if present, and how spacing and other formatting information is lost when formatting the output as a blockquote rather than a code block, I find it hard to be confident that I understand the output. So it could be that I am missing something, but based on that output, it looks like it might only be one traceback rather than two, in which case one of the tries may not have raised an exception even if it did not behave as intended. I don't think there is enough information here to determine whether or not there is a bug or, if there is, to work toward a fix. I would be curious what is shown under the conditions where the script you showed produces output like you showed, if instead you open a Python REPL, import the necessary modules, and run the one-line expression statement: git.Repo.clone_from('[email protected]:gitpython-developers/GitPython.git', Path.cwd() / 'gitpython') This is what that looks like for me:
As shown, that successfully clones the repo in Edit: Fixed the first occurrence of the |
I am using GitPython both in windows and WSL and I noticed that paths are not handled coherently between the two (i.e. C:/ vs /mnt/c). It is possible to go around it most of the time using
wslpath
and converting from Windows to WSL and vice versa but it looks that the clone_from() ends up raising an exception regardless if theto_path
is in WSL format or Windows format.Steps to reproduce:
Expected behaviour:
When the script is launched from a python instance running on WSL the repo is cloned in
$PWD/gitpython
.Actual behaviour:
The text was updated successfully, but these errors were encountered: