Skip to content

Couldn't clone repository on Windows machine #1393

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

Closed
NTMan opened this issue Dec 7, 2017 · 9 comments
Closed

Couldn't clone repository on Windows machine #1393

NTMan opened this issue Dec 7, 2017 · 9 comments
Labels

Comments

@NTMan
Copy link

NTMan commented Dec 7, 2017

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

C:\git\kernel3\linux>git --version --build-options
git version 2.15.1.windows.2
built from commit: 5d5baf91824ec7750b103c8b7c4827ffac202feb
sizeof-long: 4
machine: x86_64
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

C:\git\kernel3\linux>cmd.exe /c ver

Microsoft Windows [Version 6.1.7601]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

C:\git\kernel3\linux>cat /etc/install-options.txt
Editor Option: Notepad++
Path Option: CmdTools
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: ConHost
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

CMD

C:\git\kernel3>git clone -b amd-staging-drm-next git://people.freedesktop.org/~agd5f/linux
Cloning into 'linux'...
remote: Counting objects: 6065169, done.
remote: Compressing objects: 100% (918766/918766), done.
Receiving objects: 100% (6065169/6065169), 1.07 GiB | 1.86 MiB/s, done.ceiving objects: 100% (6065169/6065169), 1.07 GiB | 2.91 MiB/s

Resolving deltas: 100% (5114607/5114607), done.
error: unable to stat just-written file drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c: No such file or directory
error: unable to stat just-written file drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h: No such file or directory
error: unable to stat just-written file include/soc/arc/aux.h: No such file or directory
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

C:\git\kernel3>cp linux/.gitattributes "c:/git/kernel3/linux/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c"

C:\git\kernel3>cat linux/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
*.c   diff=cpp
*.h   diff=cpp

C:\git\kernel3>print "111" > "c:/git/kernel3/linux/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c"

C:\git\kernel3>cat linux/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
*.c   diff=cpp
*.h   diff=cpp

C:\git\kernel3\linux>git checkout -f HEAD
error: unable to stat just-written file drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c: No such file or directory
error: unable to stat just-written file drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h: No such file or directory
error: unable to stat just-written file include/soc/arc/aux.h: No such file or directory
Checking out files: 100% (62301/62301), done.
Your branch is up to date with 'origin/amd-staging-drm-next'.

C:\git\kernel3\linux>cat drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
*.c   diff=cpp
*.h   diff=cpp
  • What did you expect to occur after running these commands?

Clone repository without error messages.

  • What actually happened instead?

I see error messages:

error: unable to stat just-written file drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c: No such file or directory
error: unable to stat just-written file drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h: No such file or directory
error: unable to stat just-written file include/soc/arc/aux.h: No such file or directory
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.

But I am able create such files manually.

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

git://people.freedesktop.org/~agd5f/linux

@PhilipOakley
Copy link

Just to note that the clone succeeded. see:

warning: Clone succeeded, but checkout failed.

It is the checkout that failed.

the most likely cause (typically) is that the repo you have cloned has a file or directory that tries to use a forbidden Window character in the .

Try inspecting the trees with the gitk and git giu viewer. Look in the areas reported.

@PhilipOakley
Copy link

The other option is that you have a set up with a file system that is causing a race between the file writing and the file being available for the stat.

@shiftkey
Copy link

shiftkey commented Dec 7, 2017

error: unable to stat just-written file drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c: No such file or directory
error: unable to stat just-written file drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h: No such file or directory
error: unable to stat just-written file include/soc/arc/aux.h: No such file or directory

aux is a reserved filename on Windows (citation):

Do not use the following reserved names for the name of a file:
CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended. For more information, see Namespaces.

@dscho dscho closed this as completed Dec 8, 2017
@dscho dscho added the question label Dec 8, 2017
@NTMan
Copy link
Author

NTMan commented Dec 8, 2017

I checked what is happens if trying add aux.c file in empty repository under Windows.

C:\git\bug\TestBug>
C:\git\bug\TestBug>git add AUXE.C

C:\git\bug\TestBug>git add AUX.C

Executing command git add AUX.C cause git hung.
It obvious related to reserved files names.
But:

  1. Windows able works with this files itself. create, modify, delete in file managers such as FAR manager.
  2. I can not influence in any way shared projects which already used such files names in repository.

So my question still open.
It's impossible use another Win API for possible working with such files?

@dscho
Copy link
Member

dscho commented Dec 13, 2017

While FAR manager might side-step the checks, it is still an illegal file name on Windows. Git is not the only program respecting that.

@dscho
Copy link
Member

dscho commented Dec 13, 2017

Having said that, @NTMan how is your C fu? If it is good enough, I can help you implement a special mode to side-step the Win32 limitations via an opt-in config setting in Git, too. You will have to put in a little bit of effort yourself, of course, but that's a minuscule amount of work compared to the work that went into Git so far, and that you have been given for free.

@prosaiccode
Copy link

prosaiccode commented Oct 29, 2018

This should be re-opened as it is solvable.

Windows has some reserved words from the old MSDOS days. "AUX" is one of those words.

You can bypass these restrictions with some clever use of the terminal
> echo "" > \\.\[ABSOLUTE PATH]
in this case it's C:\git\kernel3\linux\drivers\gpu\drm\nouveau\nvkm\subdev\i2c\aux.c

You can edit these files though if they have a smart project view.
I used Notepad++ cause I'm a scrub

Opening the files through the gui window gives an error containing "\." or "\?"
however if you use terminal everything works fine.
> notepad++.exe \\.\C:\git\kernel3\linux\drivers\gpu\drm\nouveau\nvkm\subdev\i2c\aux.c

Once the changes are saved, we still can't commit. Git has the permissions it needs, but the system is blocking access to it because of the file name, "aux".

git cmd/ps
> git stage \\.\C:\git\kernel3\linux\drivers\gpu\drm\nouveau\nvkm\subdev\i2c\aux.c
fatal: \.\C:\git\kernel3\linux\drivers\gpu\drm\nouveau\nvkm\subdev\i2c\aux.c: \.\C:\git\kernel3\linux\drivers\gpu\drm\nouveau\nvkm\subdev\i2c\aux.c' is outside repository

git bash
$ git stage \\\\.\\C:\\git\\kernel3\\linux\\drivers\\gpu\\drm\\nouveau\\nvkm\\subdev\\i2c\\aux.c
fatal: \.\C:\git\kernel3\linux\drivers\gpu\drm\nouveau\nvkm\subdev\i2c\aux.c: \.\C:\git\kernel3\linux\drivers\gpu\drm\nouveau\nvkm\subdev\i2c\aux.c' is outside repository
(any loss of backslashes is strictly done by github)

Reserved words

  • CON
  • PRN
  • AUX
  • CLOCK$
  • NUL
  • COM0
  • COM1
  • COM2
  • COM3
  • COM4
  • COM5
  • COM6
  • COM7
  • COM8
  • COM9
  • LPT0
  • LPT1
  • LPT2
  • LPT3
  • LPT4
  • LPT5
  • LPT6
  • LPT7
  • LPT8
  • LPT9

Windows is case INsensitive when it comes to these reserved words, AuX or coN will still prevent access.

con is the most common file that will cause a problem due to web services.

these are the only two rules that cause problems, all other instances are allowed.
$RESERVED = access denied
$RESERVED.* = access denied

@dscho
Copy link
Member

dscho commented Oct 30, 2018

This should be re-opened as it is solvable.

I think the final verdict was: sure, Git could write those files, but all other software would not be able to handle them, so let's not special-case Git.

@PhilipOakley
Copy link

@prosaiccode, I think what is missing is a good explanation of how the 'proposal' would work and the benefits and hassles to the various communities. That explanation should explain clearly what the proposal itself is (there are variants that may be possible, so some 'exact' split would be needed).

I suspect there are (at least) two camps here:

  1. Those that want to collaborate on an open source project that is primarily in the 'Linux'/Posix vein that does have case sensitive files, files with special characters etc, and such a user wishes to be able to simply clone the upstream repo while on windows and have a successful [decide exactly what that means] checkout, and then be able to edit many [all?] of the files and commit an update.

  2. Regular Windows users who don't want special file types or other 'hassle' that occurs when someone has case sensitive files and file names with special characters [the status quo]

  3. some mix and match of the clone/checkout failure vs the special char/case sensitive distinction. (etc).

I could see that an option to clone would be to 'ignore invalid windows paths' on checkout, which would just report the list of faulty filenames. The subsequent edit/commit cycle could be a further issue that needs some aspects of the assume-unchanged (remembering that all the internet explanations are wrong about what it does, and what you, the user, promised...!)

It maybe that an extra upstream flag is needed (haven't checked) for files that are assume-unchanged and not checked out, for which the likes of 'commit -a' would still work.

The upshot is that this does need someone to propose some code (or initial pseudo code) to get the ball rolling and the problems of different stakeholders incorporated.

We hope you can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants