"git cannot read the current working directory without errors" - posh git (windows 10)

I get this error: Unable to read current working directory: No error when I execute any git command in any directory.

To use git in powershell, I installed github for Windows (GUI version) by editing the powershell profile file as described here: https://git-scm.com/book/it/v2/Git-in-Other-Environments-Git -in-powershell

 . (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1") . $env:github_posh_git\profile.example.ps1 

This happened when I updated the github desktop yesterday (now I have it in version: 3.0.9.0)

What can I do?

UPDATE:

Obviously, I did not work in a non-existent directory. I tried deleting and creating directories, but this will not work. git is not working everywhere, also if I create a dir and execute git init on it, it will not work.

+6
source share
4 answers

I reported this as a problem in posh git repo on github: https://github.com/dahlbyk/posh-git/issues/236

And in another project, where someone had the same problem: https://github.com/git-for-windows/git/issues/473

In my opinion, Windows 10 brought something (symbolic links?), Updating itself, and for it to work (how can you read the problem from the second link) to link to my documents folder (where I save all my github repos) I no longer writing cd documenti (folder name with the italian name), but cd documents , and it just works.

+1
source

I have the same problem with Windows 7 and I found a very simple solution. Instead of typing:

 cd ~/My Documents 

instead of this:

 cd ~/Documents 

~ / My documents is a symbolic link to ~ / Documents , which is created automatically when creating an account, but Git has problems with it.

An easy way to determine if Git is working correctly in your current directory is to look for the branch name at the bash prompt, for example:

 ~/Documents/someFolder (master) $ 

If you do not see the name of the branch, then Git does not see it.

+9
source

Maybe your current working directory has been deleted or changed to a nonexistent path?

Use pwd to check the current directory if it does not exist. Install git to use a different directory:

 git --git-dir=/mycode/.git --work-tree=/mycode status 

or create the directory yourself.

+2
source

This is a permission issue on actual or staging folders.

https://github.com/git-for-windows/git/issues/473

0
source

All Articles