javascript - 在 Windows XP 上安装 ungit 错误 : C:/Documents: No such file or directory

标签 javascript node.js git windows-xp npm

Ungit看起来是学习 git 如何工作的完美工具,因为它提供了一个图形界面来了解正在发生的事情。我想分享这个video explanation (即使您不打算使用 ungit,对于了解 git 的工作原理也非常有用)。

它已经完美地同步了我的本地存储库。不幸的是,当我输入 bickbucket git url 时,它产生了以下错误:

Ungit 尝试运行 git 命令,但导致出现未处理的错误。自动错误报告已发送。

命令(我没有自己输入,输入 URL 后 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"

然后,浏览器中出现一个表单,用于写入我的用户名和密码。我写了它们,新的错误出现在命令行中(而不是在浏览器的用户界面中)。

屏幕截图:

screenshot of the new error

<小时/>

更新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 专家,所以我需要一些时间来了解如何构建正确的路径...

<小时/>

更新3:更新2代码的临时修复如下:

[这是一个修复,所以我将其写为答案]

最佳答案

UPDATE 2代码的临时修复如下:

  function credentialsOption(socketId) {
    var credentialsHelperPath = path.resolve(__dirname, '..', 'bin', 'credentials-helper').replace(/\\/g, '/'); 
    var botchedFix1 = '-c credential.helper="' + credentialsHelperPath + ' ' + socketId + '" ';
    var botchedFix2 = botchedFix1.replace("Documents and Settings","'Documents and Settings'");  
    botchedFix2 = botchedFix2.replace("Datos de programa","'Datos de programa'");   
    return botchedFix2; 
    }

然后,如果我在互联网浏览器 (Firefox) 的用户界面中单击 Fetch Nodes fromprototype-towunderlist2,我就可以输入我的用户名和密码。 不幸的是,我遇到了一个新错误:

命令

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

错误

Error: Command failed: fatal: Authentication failed for 'https://chelder86@bitbucket.org/chelder86/prototype-towunderlist2.git/'

但是,如果您将相同的命令复制并粘贴到新的 cmd(命令行)中,则看起来工作完美推送也有效

随意改进我丑陋的解决方案!

关于javascript - 在 Windows XP 上安装 ungit 错误 : C:/Documents: No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21680998/

相关文章:

javascript - 当悬停的元素被另一个元素覆盖时,不会触发 mouseout

javascript - 当不同文件中存在测试时,如何在 jasmine 中对测试套件进行分组?

javascript - 从 javascript 插入 html

使用 PHP 语句填充元素的 innerHTML 的 JavaScript 函数不起作用

javascript - 序列化嵌套模型的 where 条件

git - 如何使用 Git 删除远程分支?

node.js - Mongoose populate() 返回空数组

git - Angular-phonecat 教程 - 服务器不工作

windows - Windows 上的 Git 别名 : How to escape double quotes

git - git clone --mirror 和 pull 有什么区别