git/list[1] front-page[2] threads[3] people[4] search[5] about
 

`git add <<windows 8.3 path to file inside repo>>` results in "fatal: ... is outside repository"

From
Anthony Sottile <asottile@umich.edu>
Date
Mar 10, 2019, 22:41 UTC
Message-ID
<CA+dzEBkkbQj0rCjvPfcET2Uvt6fP_v+wQE52ZkAND2Mps08SNQ@mail.gmail.com>

(In case 8.3 filename isn't a familiar term): https://en.wikipedia.org/wiki/8.3_filename

This is distilled down from an actual issue to a minimal testcase.

The original failure involves an automated test while running on azure pipelines: https://asottile.visualstudio.com/asottile/_build/results?buildId=254

I'm using git on windows
>git --version
git version 2.21.0.windows.1
Here's a minimal case:

git init longname-repo cd longname-repo touch f git add ..\longna~1\f

Here's the output:

C:\Users\Anthony\AppData\Local\Temp\t\pre-commit-hooks>git init longname-repo Initialized empty Git repository in C:/Users/Anthony/AppData/Local/Temp/t/pre-commit-hooks/longname-repo/.git/

C:\Users\Anthony\AppData\Local\Temp\t\pre-commit-hooks>cd longname-repo
C:\Users\Anthony\AppData\Local\Temp\t\pre-commit-hooks\longname-repo>touch f

C:\Users\Anthony\AppData\Local\Temp\t\pre-commit-hooks\longname-repo>git add ..\longna~1\f fatal: ..\longna~1\f: '..\longna~1\f' is outside repository

It is however inside the repository:

C:\Users\Anthony\AppData\Local\Temp\t\pre-commit-hooks\longname-repo>python Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

>>> import os
>>> os.path.samefile('f', r'..\longna~1\f')
True
Anthony
Next: Johannes Sixt
Message 1 of 8 in “`git add <<windows 8.3 path to file inside repo>>` results in "fatal: ... is outside repository"”
  1. Anthony SottileMar 10, 2019
  2. Johannes SixtMar 11, 2019
  3. Anthony SottileMar 11, 2019
  4. Torsten BögershausenMar 11, 2019
  5. Anthony SottileMar 11, 2019
  6. Jack Adrian ZappaMar 11, 2019
  7. Anthony SottileMar 11, 2019
  8. Johannes SchindelinMar 12, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.