Skip to content

file: protocol support on Windows doesn't appear to work #415

@tomqwpl

Description

@tomqwpl

I'm trying to use go-git with a file: protocol on Windows.

So my URL is something like "file:///c:/directory".
This parses correctly, host is "" (correctly), but the curiosity with windows file uRLs is that the path is then "/c:/directory".

This path is then passed to the git command line directly, and git then fails to clone.

It gives the appearance of working if you use a file url of "file://c:/directory", so only two slashes.
It only appears to work though, as the URL is parsed as "c" being the host, and "/directory" being the path. So it works as long as your current drive is "c:".

The logic for converting file: URLs into actual usable windows file paths has to be something like "if windows and path starts slash, letter, colon, slash, then remove the leading slash".

Note that you can't use windows file paths in go-git without using the URL form, as it interprets it as an scp like URL and not a file path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is neededstaleIssues/PRs that are marked for closure due to inactivitywindows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions