15

I have been using VScode for a long time, and I have used the git functionality a lot. But it has suddenly started failing. Every time I try to add a file, a single file, it says there is an error:

git add -A -- ""repository folder""/README.md

fatal: ""repository folder""/README.md' is outside repository

I have checked the settings and there is nothing weird and also, when I add all files at once instead of just one at a time, it works well. If I add the files with the terminal's commands, it works too.

SherylHohman
  • 16,580
  • 17
  • 88
  • 94
jesusjimsa
  • 325
  • 1
  • 3
  • 13

9 Answers9

52

I have got this problem after installing May 2020 VSCode update (v1.46).

After comparing git commands of the old and the new VSCode it appeared that updated VSCode uses low case drive letter in the path for the git command, but the old one used upper case letter. The ignorecase git option that should solve those problem was already set to true.

Updating git to version 2.27 solved the problem.

Oleg Skydan
  • 681
  • 1
  • 5
  • 5
  • 13
    Update the Git for windows worked very well for me!! I use the `git update-git-for-windows`, form https://stackoverflow.com/questions/13790592/how-to-upgrade-to-the-latest-version-of-git-on-windows-still-showing-older-vers#answer-55180131 – KevynTD Jun 16 '20 at 04:52
  • Thanks! This helped me for this strange issue! – Deekshith Hegde Jun 17 '20 at 17:29
  • 1
    I would recommend to take a look to https://git-scm.com/download/win and do not forget to restart the VScode ;) – andrey Jul 03 '20 at 09:08
  • I agree with @KevynTuleuDourado that https://stackoverflow.com/a/55180131/470749 was very helpful in knowing how to update Git, depending on what your current version of Git is. – Ryan Aug 16 '20 at 13:57
13

What fixed it for me was:

Being a Windows and VScode user, I fixed this by updating GIT. You do that by going to https://gitforwindows.org/ and installing.

MiloTheGreat
  • 710
  • 7
  • 14
11

If you use ASCII / Special chars (like æøå) in your path name this error occurs. Rename your path names / directories to the fix issue.

Be aware all parent paths for your projects directory needs to be changed, not just your paths / directories within your project.

Michael Falck Wedelgård
  • 2,943
  • 1
  • 27
  • 39
10

my vs code recently got updated to May 2020 release. Just after this the above git issue starting happening. So i rollback version of my vs code to April 2020 release and now again git extension works

sonu kumar
  • 143
  • 1
  • 8
6

Looks like the root cause mentioned in someone else's answer is correct:

I have got this problem after installing May 2020 VSCode update (v1.46).

After comparing git commands of the old and the new VSCode it appeared that updated VSCode uses low case drive letter in the path for the git command, but the old one used upper case letter.

I can see the git error complaining about e:\... while Windows shows E:\....

Adding ignorecase=true didn't do it for me. Instead, I ran git version (which reported 2.9.x). The latest git as of writing was 2.27.y. Upgrading git solved it for me.

nightblade9
  • 354
  • 2
  • 15
1

I had to change my git config to get this working in my vs code. From git version 1.6.1.9 for windows, "ignorecase=true' in config is set by default. If you did not previously configure this in your repos you can change it to false by doing the following via your terminal in the directory with .git folder in:

git config --local -e

Under the core options, set ignorecase to false using the text editor

ignorecase=false

Hope it helps

Dan Smit
  • 31
  • 2
0

To users who use language other than English, this could help solving the problem.

git config --global core.precomposeunicode false
Yewon
  • 1
-1

Problem is you're trying to add something, not in the root directory which includes .git directory and sub-dirs. The file you're trying to add is outside its scope.

Don't add the file as full path. Type git status on your branch and just add the file.

Just do the simple thing. For example:

git add README.md
git commit -m "Commit message"
git checkout master

You can merge or rebase depending on your choice.

SherylHohman
  • 16,580
  • 17
  • 88
  • 94
danglingpointer
  • 4,708
  • 3
  • 24
  • 42
-1

If using: Mac OS 10 + VSCode Extension Git History 0.6.10.

Uninstalled restart VSCode reinstall Git History.

Working again.

Ben LeDuc
  • 1
  • 1