“git 无法读取当前工作目录没有错误” - posh git (windows 10)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34084722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"git unable to read current working directory no error" - posh git (windows 10)
提问by Giacomo Cerquone
I receive this error: Unable to read current working directory: No error
when I execute any git command in any directory.
我收到此错误:Unable to read current working directory: No error
当我在任何目录中执行任何 git 命令时。
To use git on powershell I installed github for windows (the GUI version) editing the powershell profile file as described here: https://git-scm.com/book/it/v2/Git-in-Other-Environments-Git-in-Powershell
要在 powershell 上使用 git,我安装了 github for windows(GUI 版本),如下所述编辑 powershell 配置文件:https: //git-scm.com/book/it/v2/Git-in-Other-Environments-Git-在 Powershell
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1")
. $env:github_posh_git\profile.example.ps1
This happened when yesterday I updated github desktop (I've it now at version: 3.0.9.0)
这发生在昨天我更新 github 桌面时(我现在的版本是:3.0.9.0)
What can I do?
我能做什么?
UPDATE:
更新:
Obviously I wasn't working in a non-existing directory. I tried to delete and re create directories but it doesn't work. Git doesn't work everywhere, also if I create a dir and execute git init in it, it won't work.
显然我不是在一个不存在的目录中工作。我试图删除并重新创建目录,但它不起作用。Git 不能在任何地方工作,如果我创建一个目录并在其中执行 git init,它也不会工作。
采纳答案by Giacomo Cerquone
I reported this as issue in the posh-git repo on github: https://github.com/dahlbyk/posh-git/issues/236
我在 github 上的 posh-git repo 中将此报告为问题:https: //github.com/dahlbyk/posh-git/issues/236
And in another project where someone was having my same problem: https://github.com/git-for-windows/git/issues/473
在另一个项目中,有人遇到了同样的问题:https: //github.com/git-for-windows/git/issues/473
In my opinion, Windows 10 screwed up something (symlinks?) updating itself and in order to make it works (as you can read from the second link of the issue) to refer to my documents folder (where I keep all my github repos) I don't write anymore cd documenti
(the italian folder name) but cd documents
and it just works.
在我看来,Windows 10 搞砸了一些东西(符号链接?)自我更新并使其工作(正如您可以从问题的第二个链接中阅读的那样)来引用我的文档文件夹(我保存了我所有的 github 存储库)我不再写cd documenti
(意大利文文件夹名称),但cd documents
它确实有效。
回答by Michael Sheaver
I have this same issue with Windows 7, and discovered a really easy solution to it. Instead of typing:
我在 Windows 7 上遇到了同样的问题,并发现了一个非常简单的解决方案。而不是键入:
cd ~/My Documents
type instead:
输入:
cd ~/Documents
The ~/My Documentsis a symbolic link to ~/Documentsthat is created automatically upon account creation, but Git has trouble with it.
在〜/ My Documents文件是一个符号链接到〜/文稿是在帐户创建时自动创建的,但Git有麻烦了。
An easy way to determine if Git is working correctly in your current directory is to look for the branch name in the bash prompt, like so:
确定 Git 在当前目录中是否正常工作的一种简单方法是在 bash 提示符中查找分支名称,如下所示:
~/Documents/someFolder (master)
$
If you don't see the branch name, then Git is not seeing it.
如果您没有看到分支名称,则 Git 没有看到它。
回答by Sander B
Maybe your current working directory was removed or has changed to a nonexisting path?
也许您当前的工作目录已被删除或已更改为不存在的路径?
Use pwd
to check your current directory, if it doesnt exist set git to use another directory:
使用pwd
来检查你的当前目录,如果它不存在一套GIT中使用另一个目录:
git --git-dir=/mycode/.git --work-tree=/mycode status
or create the directory yourself.
或者自己创建目录。
回答by Ish Arora
This is the issue with permission on actual or intermediate folders.
这是对实际或中间文件夹的权限问题。