【问题标题】:My Git installation always refers to the wrong directory. Why?我的 Git 安装总是引用错误的目录。为什么?
【发布时间】:2013-06-13 05:32:42
【问题描述】:

我在我的 Windows8 机器上安装并重新安装了 Git 多次。至于我为什么这样做,这是一个很长的故事。一旦我在 C:\Git 安装它,现在我将它安装在 C:\Program Files (x86)\Git ,现在我遇到了 Git 配置问题。我的 Git 配置无法将安全凭证写入 Git 配置文件,因为它认为它们位于不再存在的位置 (C:\Git)。

因此,我总是求助于使用 GitHub GUI,但这不适用于 Heroku。所以现在我需要帮助。

例如,当尝试将代码推送到 Heroku 时,我得到:

C:\IntelliJ IDEA 12.1.4\workspace\signup-sheet>git remote -v
heroku  git@heroku.com:signup-sheet.git (fetch)
heroku  git@heroku.com:signup-sheet.git (push)
origin  https://github.com/djangofan/signup-sheet.git (fetch)
origin  https://github.com/djangofan/signup-sheet.git (push)
C:\IntelliJ IDEA 12.1.4\workspace\signup-sheet>git push heroku master
Could not create directory '/c/Git/.ssh'.
The authenticity of host 'heroku.com (__.__.__.156)' can't be established.
RSA key fingerprint is 8b:48:5e:00:0e:00:16:00:32:00:87:0c:00:c8:60:ad.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/c/Git/.ssh/known_hosts).
Permission denied (publickey).
fatal: Could not read from remote repository.

还有,

C:\IntelliJ IDEA 12.1.4\workspace\signup-sheet>git config --global user.email "djangofan@gmail.com"
error: could not lock config file C:\Git/.gitconfig: No such file or directory

【问题讨论】:

  • 这似乎是 Windows cmd shell,您尝试使用 Git Bash (MINGW32) 吗?
  • 你检查你的 PATH 设置了吗?

标签: git heroku


【解决方案1】:

这与环境变量HOME的值相关联。

使用旧的 msysgit,git-cmd.bat 包含:

@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%

使用新的 git-for-windows,git.exe 是用以下方式构建的:

--cd-to-home"; WorkingDir: %HOMEDRIVE%%HOMEPATH%

在这两种情况下,HOME 默认设置为 %HOMEDRIVE%%HOMEPATH%

【讨论】:

  • 这为我解决了问题。我没想到 Git var 会是 HOME 而不是 GIT_HOME 我正在寻找后者。这下全说通了。谢谢。
猜你喜欢
  • 2013-11-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多