Git Fetch Error with UNC

后端 未结 2 750
北海茫月
北海茫月 2021-01-16 16:23

I have a GIT backup script that runs perfectly when executed from command line (it\'s a daily backup of our main GIT rep):

@echo off
rem -- Set Parameters
re         


        
2条回答
  •  半阙折子戏
    2021-01-16 16:40

    With Git 2.24 (Q4 2019), you can specify explicitly the UNC path with the file:// protocol.

    That fixes git-for-windows/git issue 1264, where using such an URL failed:

    $ git clone file://server/file/path/here
    Cloning into 'here'...
    fatal: 'C:/Program Files/Git/file/path/here' does not appear to be a git repository
    fatal: Could not read from remote repository.
    

    See commit ebb8d2c (24 Aug 2019) by Torsten Bögershausen (tboegi).
    (Merged by Junio C Hamano -- gitster -- in commit aadac06, 30 Sep 2019)

    mingw: support UNC in git clone file://server/share/repo

    Extend the parser to accept file://server/share/repo in the way that Windows users expect it to be parsed who are used to referring to file shares by UNC paths of the form \\server\share\folder.

    Tightened check to avoid handling file://C:/some/path as a UNC path.


    Git 2.25.2 (March 2020) adds tests for this use-case.

    See commit bfe2bbb (13 Feb 2020) by Johannes Schindelin (dscho).
    (Merged by Junio C Hamano -- gitster -- in commit fc25a19, 17 Feb 2020)

    t5580: test cloning without file://, test fetching via UNC paths

    Signed-off-by: Johannes Schindelin

    On Windows, it is quite common to work with network drives. The format of the paths to network drives (or "network shares", or UNC paths) is:

    \\\\...
    

    We already have a couple regression tests revolving around those types of paths, but we missed cloning and fetching from UNC paths without leading file:// (and with backslashes instead of forward slashes). This lil' patch closes that gap.

    It gets a bit silly to add the commands to the name of the test script, so let's just rename it while we're testing more UNC stuff.

提交回复
热议问题