René's URL Explorer Experiment


Title: git.Repo.clone_from() not working correctly in WSL · Issue #1902 · gitpython-developers/GitPython · GitHub

Open Graph Title: git.Repo.clone_from() not working correctly in WSL · Issue #1902 · gitpython-developers/GitPython

X Title: git.Repo.clone_from() not working correctly in WSL · Issue #1902 · gitpython-developers/GitPython

Description: 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 v...

Open Graph Description: 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 ...

X Description: 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 ...

Opengraph URL: https://github.com/gitpython-developers/GitPython/issues/1902

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"git.Repo.clone_from() not working correctly in WSL","articleBody":"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 the `to_path` is in WSL format or Windows format.\r\n\r\nSteps to reproduce:\r\n```\r\nfrom pathlib import Path\r\nimport git\r\nimport traceback\r\nimport subprocess\r\n\r\ndef to_windows_path(wsl_path: Path) -\u003e Path:\r\n    \"\"\" Converts a WSL path to windows path - works only if the WSL path actually exists \"\"\"\r\n    wslpath_process = subprocess.run(['wslpath', '-w', wsl_path], text=True, capture_output=True)\r\n    return Path(wslpath_process.stdout.strip())\r\n\r\ntry:\r\n  git.Repo.clone_from('git@github.com:gitpython-developers/GitPython.git', Path.cwd() / 'gitpython')\r\nexcept git.GitCommandError:\r\n  print(traceback.format_exc())\r\n\r\ntry:\r\n  git.Repo.clone_from('git@github.com:gitpython-developers/GitPython.git', to_windows_path(Path.cwd()) / 'gitpython')\r\nexcept git.NoSuchPathError:\r\n  print(traceback.format_exc())\r\n```\r\n\r\nExpected behaviour:\r\nWhen the script is launched from a python instance running on WSL the repo is cloned in `$PWD/gitpython`.\r\n\r\nActual behaviour:\r\n\u003e [if (Path.cwd() / 'gitpython').exists() == False before running the script]\r\n\u003e [git.__version__ == '3.1.40']\r\n\u003e python the_script.py\r\n\r\n\u003e File ~/anaconda3/lib/python3.11/site-packages/git/repo/base.py:1328, in Repo.clone_from(cls, url, to_path, progress, env, multi_options, allow_unsafe_protocols, allow_unsafe_options, **kwargs)\r\n\u003e    1326 if env is not None:\r\n\u003e    1327     git.update_environment(**env)\r\n\u003e -\u003e 1328 return cls._clone(\r\n\u003e    1329     git,\r\n\u003e    1330     url,\r\n\u003e    1331     to_path,\r\n\u003e    1332     GitCmdObjectDB,\r\n\u003e    1333     progress,\r\n\u003e    1334     multi_options,\r\n\u003e    1335     allow_unsafe_protocols=allow_unsafe_protocols,\r\n\u003e    1336     allow_unsafe_options=allow_unsafe_options,\r\n\u003e    1337     **kwargs,\r\n\u003e    1338 )\r\n\u003e \r\n\u003e File ~/anaconda3/lib/python3.11/site-packages/git/repo/base.py:1244, in Repo._clone(cls, git, url, path, odb_default_type, progress, multi_options, allow_unsafe_protocols, allow_unsafe_options, **kwargs)\r\n\u003e    1241 if not osp.isabs(path):\r\n\u003e    1242     path = osp.join(git._working_dir, path) if git._working_dir is not None else path\r\n\u003e -\u003e 1244 repo = cls(path, odbt=odbt)\r\n\u003e    1246 # retain env values that were passed to _clone()\r\n\u003e    1247 repo.git.update_environment(**git.environment())\r\n\u003e \r\n\u003e File ~/anaconda3/lib/python3.11/site-packages/git/repo/base.py:215, in Repo.__init__(self, path, odbt, search_parent_directories, expand_vars)\r\n\u003e     213 if epath is not None:\r\n\u003e     214     if not os.path.exists(epath):\r\n\u003e --\u003e 215         raise NoSuchPathError(epath)\r\n\u003e     217 ## Walk up the path to find the `.git` dir.\r\n\u003e     218 #\r\n\u003e     219 curpath = epath\r\n\u003e NoSuchPathError: /mnt/c/Users/user.name/Documents/C:\\Users\\user.name\\Documents/gitpython","author":{"url":"https://github.com/paolzpk","@type":"Person","name":"paolzpk"},"datePublished":"2024-04-15T15:18:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/1902/GitPython/issues/1902"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:81bcbcf8-19ca-47e1-3c26-3e7dc15883b8
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9CD4:2A0665:70632:95606:6A4C1B76
html-safe-noncee42749128526a8e4c42a19280b11dfe334b4f5e6c416fc3606a0b3c9d8e102c6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0Q0OjJBMDY2NTo3MDYzMjo5NTYwNjo2QTRDMUI3NiIsInZpc2l0b3JfaWQiOiI3MDIyMjg5NjI1NDQwNTkwNzEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmace71ce10cdeb6cddbd57dfd9f97281a460fbbf136b5dc4819e9eb170a6715e4bc
hovercard-subject-tagissue:2243948431
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/gitpython-developers/GitPython/1902/issue_layout
twitter:imagehttps://opengraph.githubassets.com/80d5df62c6f48f3d1ffb1f35244d0c3a40a97657c3abc89499635e667283a73d/gitpython-developers/GitPython/issues/1902
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/80d5df62c6f48f3d1ffb1f35244d0c3a40a97657c3abc89499635e667283a73d/gitpython-developers/GitPython/issues/1902
og:image:altI 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 ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepaolzpk
hostnamegithub.com
expected-hostnamegithub.com
None0ccfc9e5281bfe12e38a4d632dc422843e4d5b6757917f7efda2f6567d72fea9
turbo-cache-controlno-preview
go-importgithub.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git
octolytics-dimension-user_id503709
octolytics-dimension-user_logingitpython-developers
octolytics-dimension-repository_id1126087
octolytics-dimension-repository_nwogitpython-developers/GitPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1126087
octolytics-dimension-repository_network_root_nwogitpython-developers/GitPython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release17b2c8bc78100cad23202aad2074e77ead6bd1d6
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/gitpython-developers/GitPython/issues/1902#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fissues%2F1902
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fissues%2F1902
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=gitpython-developers%2FGitPython
Reloadhttps://github.com/gitpython-developers/GitPython/issues/1902
Reloadhttps://github.com/gitpython-developers/GitPython/issues/1902
Reloadhttps://github.com/gitpython-developers/GitPython/issues/1902
Please reload this pagehttps://github.com/gitpython-developers/GitPython/issues/1902
gitpython-developers https://github.com/gitpython-developers
GitPythonhttps://github.com/gitpython-developers/GitPython
Please reload this pagehttps://github.com/gitpython-developers/GitPython/issues/1902
Notifications https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Fork 982 https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Star 5.1k https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Code https://github.com/gitpython-developers/GitPython
Issues 166 https://github.com/gitpython-developers/GitPython/issues
Pull requests 12 https://github.com/gitpython-developers/GitPython/pulls
Discussions https://github.com/gitpython-developers/GitPython/discussions
Actions https://github.com/gitpython-developers/GitPython/actions
Security and quality 8 https://github.com/gitpython-developers/GitPython/security
Insights https://github.com/gitpython-developers/GitPython/pulse
Code https://github.com/gitpython-developers/GitPython
Issues https://github.com/gitpython-developers/GitPython/issues
Pull requests https://github.com/gitpython-developers/GitPython/pulls
Discussions https://github.com/gitpython-developers/GitPython/discussions
Actions https://github.com/gitpython-developers/GitPython/actions
Security and quality https://github.com/gitpython-developers/GitPython/security
Insights https://github.com/gitpython-developers/GitPython/pulse
git.Repo.clone_from() not working correctly in WSLhttps://github.com/gitpython-developers/GitPython/issues/1902#top
acknowledgedhttps://github.com/gitpython-developers/GitPython/issues?q=state%3Aopen%20label%3A%22acknowledged%22
help wantedhttps://github.com/gitpython-developers/GitPython/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
waiting for feedbackhttps://github.com/gitpython-developers/GitPython/issues?q=state%3Aopen%20label%3A%22waiting%20for%20feedback%22
https://github.com/paolzpk
paolzpkhttps://github.com/paolzpk
on Apr 15, 2024https://github.com/gitpython-developers/GitPython/issues/1902#issue-2243948431
acknowledgedhttps://github.com/gitpython-developers/GitPython/issues?q=state%3Aopen%20label%3A%22acknowledged%22
help wantedhttps://github.com/gitpython-developers/GitPython/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
waiting for feedbackhttps://github.com/gitpython-developers/GitPython/issues?q=state%3Aopen%20label%3A%22waiting%20for%20feedback%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.