Git push fail to a Windows share

前端 未结 4 1762
情歌与酒
情歌与酒 2021-01-05 10:38

I\'m trying to push from my local repository to a remote repository located in a windows share.

I\'m going to recreate a simple scenario, where c is my local hard d

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-05 11:11

    You need to state which version of git (use the git version command). When I tried this with Git for Windows 1.8.3 (and also 1.8.4 and 1.8.5) it worked ok:

    $ git remote add origin /z/ztest.git
    
    $ git remote -v
    origin  z:/ztest.git (fetch)
    origin  z:/ztest.git (push)
    
    $ GIT_TRACE=1 git push origin master
    trace: built-in: git 'push' 'origin' 'master'
    trace: run_command: 'git-receive-pack '\''z:/ztest.git'\'''
    trace: built-in: git 'receive-pack' 'z:/ztest.git'
    trace: run_command: 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
    trace: built-in: git 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
    Counting objects: 3, done.
    trace: run_command: 'unpack-objects' '--pack_header=2,3'
    Writing objects: 100% (3/3), 212 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    remote: trace: built-in: git 'unpack-objects' '--pack_header=2,3'
    trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all'
    trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all'
    trace: run_command: 'gc' '--auto' '--quiet'
    trace: built-in: git 'gc' '--auto' '--quiet'
    To z:/ztest.git
     * [new branch]      master -> master
    

    As you can see, adding GIT_TRACE=1 before the command results in additional diagnostics being printed which can help pin-point failing parts of the push command.

    In general I have tended to use the full UNC path rather than the assigned drive letter (eg: git remote add origin //MACHINE/Share/path/dir.git but you may be forced to use a drive letter if the path is really long.

    UPDATE

    Checking the git sources for the reported error shows this must be coming from sha1_file.c from a failed call to create_tmpfile in that file. In this function an attempt is made to create a temporary file called tmp_obj_XXXXXX (where the X's are replaced with something unique in git_mkstemps_mode()). If it was a permissions problem you would be getting a different message so for some reason it cannot create these temporary files on the remote drive (the error is in the unpacking part where the repository is the remote one). It tries up to 16384 times to find a unique name so the problem is likely in the directory path being used. I think you will need to compile Git for Windows and get a break point in the git_mkstemps_mode function in git/wrapper.c to find out what's going on. If you follow the installation instructions for msysGit then this will build it for you and you can try debugging.

提交回复
热议问题