【发布时间】:2014-03-05 09:08:44
【问题描述】:
Ungit 看起来是了解 git 工作原理的完美工具,因为它提供了一个图形界面来了解正在发生的事情。我想分享这个video explanation(即使您不打算使用 ungit,这对于了解 git 的工作原理也非常有用)。
它完美地同步了我的本地存储库。不幸的是,当我输入bickbucket git url时,它产生了以下错误:
Ungit 尝试运行导致未处理错误的 git 命令。已发送自动错误报告。
命令(我自己没有输入,ungit输入网址后自动发送的
git -c color.ui=false -c core.quotepath=false -c core.pager=cat -c credential.helper="C:/Documents and Settings/ch/Datos de programa/npm/node_modules/ungit/bin/credentials-helper 0" ls-remote --tags prototype-towunderlist2
错误。错误是可能是因为C:/Documents and Settings中有空格:
Error: Command failed: C:/Documents and Settings/ch/Datos de programa/npm/node_modules/ungit/bin/credentials-helper 0 get: C:/Documents: No such file or directory
fatal: could not read Password for 'https://chelder86@bitbucket.org': No such file or directory
对我来说它看起来是一个 Windows 问题,所以我在 stackoverflow 中发布了它,而不是 ungit bug report system。
更新 1。我已经找到了如何通过,但我遇到了另一个错误:
fatal: Authentication failed for 'https://chelder86@bitbucket.org/chelder86/prototype-towunderlist2.git/'
为了解决问题,我做了以下事情。我打开了一个新的 cmd(命令行)。我进入了存储库目录。我输入了相同的命令,但在双引号中添加单引号如下:
改为:
"C:/Documents and Settings/ch/Datos de programa/npm/node_modules/ungit/bin/credentials-helper 0"
我输入了:
"C:/'Documents and Settings'/ch/'Datos de programa'/npm/node_modules/ungit/bin/credentials-helper 0"
然后,浏览器中出现了一个表单,用于填写我的用户名和密码。我写了他们,新的错误出现在命令行中(不是在浏览器的用户界面中)。
截图:
UPDATE 2:生成路径"C:/Documents and Settings/ch/Datos de programa/npm/node_modules/ungit/bin/credentials-helper 0" 的行位于C:\Documents and Settings\ch\Datos de programa\npm\node_modules\ungit\source\git-api.js。它是:
function credentialsOption(socketId) {
var credentialsHelperPath = path.resolve(__dirname, '..', 'bin', 'credentials-helper').replace(/\\/g, '/');
return '-c credential.helper="' + credentialsHelperPath + ' ' + socketId + '" ';
}
我不是 Javascript 专家,所以我需要一些时间来了解如何构建正确的路径...
UPDATE 3:UPDATE 2 代码的临时修复如下:
[这是一个修复,所以我把它写成一个答案]
【问题讨论】:
-
尝试在 ls-remote 命令中使用
credential.helper="'C:/Documents and Settings/ch/Datos de programa/npm/node_modules/ungit/bin/credentials-helper' 0" -
目录中有空格 - Windows 已按预期响应 - 不需要以某种方式调用脚本以便处理空格,例如将路径放在引号内 - 所以不是 Windows 的 ungit 问题
-
整个路径需要在一组引号中而不是部分中,并且完全按照 Nevik 的建议,这不是您在此处显示的 - 在 Windows 命令行中尝试使用 c:\Documents and Settings 路径而不是你所在的那个是 d:\ch\Documents 那么你必须经常这样做
-
我在 git 扩展上遇到了类似的问题。我只是手动运行了 git-credential-winstore.exe。您在指定文件夹(.../npm/node_modules/ungit/bin/)下是否有该文件或文件凭据助手?如果是,请尝试手动运行它并再次尝试该命令。这在类似的问题上帮助了我。
-
为什么不使用SourceTree?
标签: javascript node.js git windows-xp npm