将 GitHub 用于 Windows 时出现错误
Getting errors when using GitHub for Windows
上周我在使用 git 时突然出现错误,原因不明。我只能访问 windows PC。
我遇到的错误似乎并没有给我任何关于问题出在哪里、如何以及我需要做些什么来修复它的明确答案。
错误发生在我克隆一个空存储库后,从那以后我一直在为 Windows 卸载并重新安装 GitHub,我通常只使用 Git Shell 随附安装,但 GUI 在执行除启动之外的任何操作时也存在问题。
整体错误:
WARNING: posh-git requires Git 1.7.2 or better. You have .
Couldn't open /dev/null: No such file or directory
Couldn't open /dev/null: No such file or directory
每次我 运行 一个 git
命令它都会给我 Couldn't open /dev/null: No such file or directory
.
我觉得奇怪的是它正在寻找 /dev/null,但考虑到我 运行 正在 Windows /dev/null 根本不存在。
有人知道解决这个问题的方法吗?
抱歉,我还没有代表发表评论,但是,你确定你有最新版本的 "GitHub for Windows" 吗?我以前遇到过问题,因为它没有自动更新。
还有,你平时用自带的"Git Shell"吗?这是我通常做的,所以当我重新安装时我没有任何丢失配置的问题,不知道如果你使用主 GUI 程序会发生什么......
启动 Powershell 命令后 window、运行 git --version
。 Github windows 安装 msysGit
GitHub for Windows includes a fully functional version of msysGit — no
need to install anything extra. You can pull up a PowerShell console
within the context of any repository.
Github for windows download here
Help Here
uninstall github for windows page 上有一些关于删除剩余文件的信息。
Github for windows 使用 posh-git
for git 由 powershell 使用。
Verify execution of scripts is allowed with Get-ExecutionPolicy
(should be RemoteSigned
or Unrestricted
). If scripts are not enabled, run PowerShell as Administrator and call Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm
.
我在笔记本电脑上遇到了同样的问题,我花了很多时间来理解和解决它。这是我的经验。
git 错误消息(无法打开 /dev/null(或复制失败):没有这样的文件或目录)是 linux/unix 一个。实际上,git 想表达的是它无法访问您系统的空设备。在windows中,实际上有一个空设备对应于一个空的且不可见的文件,存在于每个文件夹中。
在这里你可以打开一个window控制台(cmd)并输入命令echo sample > nul.如果您收到错误消息,则实际上您的空设备有问题。
确定问题:
- 打开设备管理器
- 菜单 查看 > 显示隐藏的设备
- 在 非即插即用驱动程序
中搜索 Null
如果它存在但处于警告状态,试试这个 (source) :
- 控制面板 > 电源选项
- 更改计划设置
- 更改高级电源设置
- 多媒体设置
- 共享媒体时 > 设置: 允许计算机进入离开模式以外的设置
- 重新启动计算机:如果问题仍然存在,我建议您备份 %SystemRoot%\system32\drivers\null.sys,删除 Null 设备(右键单击 > 卸载)并转到步骤 4。
如果不存在(或者第 3 步没有修复问题并且移除 Null 设备后):
- 按照此 How-To 安装 Null 设备(适用于 Windows XP,但它也适用于 Vista)。
- 重新启动计算机。
上周我在使用 git 时突然出现错误,原因不明。我只能访问 windows PC。
我遇到的错误似乎并没有给我任何关于问题出在哪里、如何以及我需要做些什么来修复它的明确答案。
错误发生在我克隆一个空存储库后,从那以后我一直在为 Windows 卸载并重新安装 GitHub,我通常只使用 Git Shell 随附安装,但 GUI 在执行除启动之外的任何操作时也存在问题。
整体错误:
WARNING: posh-git requires Git 1.7.2 or better. You have .
Couldn't open /dev/null: No such file or directory
Couldn't open /dev/null: No such file or directory
每次我 运行 一个 git
命令它都会给我 Couldn't open /dev/null: No such file or directory
.
我觉得奇怪的是它正在寻找 /dev/null,但考虑到我 运行 正在 Windows /dev/null 根本不存在。
有人知道解决这个问题的方法吗?
抱歉,我还没有代表发表评论,但是,你确定你有最新版本的 "GitHub for Windows" 吗?我以前遇到过问题,因为它没有自动更新。
还有,你平时用自带的"Git Shell"吗?这是我通常做的,所以当我重新安装时我没有任何丢失配置的问题,不知道如果你使用主 GUI 程序会发生什么......
启动 Powershell 命令后 window、运行 git --version
。 Github windows 安装 msysGit
GitHub for Windows includes a fully functional version of msysGit — no need to install anything extra. You can pull up a PowerShell console within the context of any repository.
Github for windows download here
Help Here
uninstall github for windows page 上有一些关于删除剩余文件的信息。
Github for windows 使用 posh-git
for git 由 powershell 使用。
Verify execution of scripts is allowed with
Get-ExecutionPolicy
(should beRemoteSigned
orUnrestricted
). If scripts are not enabled, run PowerShell as Administrator and callSet-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm
.
我在笔记本电脑上遇到了同样的问题,我花了很多时间来理解和解决它。这是我的经验。
git 错误消息(无法打开 /dev/null(或复制失败):没有这样的文件或目录)是 linux/unix 一个。实际上,git 想表达的是它无法访问您系统的空设备。在windows中,实际上有一个空设备对应于一个空的且不可见的文件,存在于每个文件夹中。
在这里你可以打开一个window控制台(cmd)并输入命令echo sample > nul.如果您收到错误消息,则实际上您的空设备有问题。
确定问题:
- 打开设备管理器
- 菜单 查看 > 显示隐藏的设备
- 在 非即插即用驱动程序 中搜索 Null
如果它存在但处于警告状态,试试这个 (source) :
- 控制面板 > 电源选项
- 更改计划设置
- 更改高级电源设置
- 多媒体设置
- 共享媒体时 > 设置: 允许计算机进入离开模式以外的设置
- 重新启动计算机:如果问题仍然存在,我建议您备份 %SystemRoot%\system32\drivers\null.sys,删除 Null 设备(右键单击 > 卸载)并转到步骤 4。
如果不存在(或者第 3 步没有修复问题并且移除 Null 设备后):
- 按照此 How-To 安装 Null 设备(适用于 Windows XP,但它也适用于 Vista)。
- 重新启动计算机。