git - 我的 Git 安装总是引用错误的目录。为什么?

标签 git heroku

我在我的 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  <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c9aea0bd89a1acbba6a2bce7aaa6a4" rel="noreferrer noopener nofollow">[email protected]</a>:signup-sheet.git (fetch)
heroku  <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d0b7b9a490b8b5a2bfbba5feb3bfbd" rel="noreferrer noopener nofollow">[email protected]</a>: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 "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2c48464d424b434a4d426c4b414d4540024f4341" rel="noreferrer noopener nofollow">[email protected]</a>"
error: could not lock config file C:\Git/.gitconfig: No such file or directory

最佳答案

这与环境变量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 - 我的 Git 安装总是引用错误的目录。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17079848/

相关文章:

git - windows : git has old github username, 无法更改 git 用户

git 格式补丁 : Repository name in prefix or generated prefix

apache - git/github 和 web 服务器部署配置

git 看不到文件...如何理解哪里出了问题?

git - "Git Push Heroku Master"- 无法登录到heroku - Cloud9 IDE

java - 是否可以在 JHipster 应用程序中获取用户的时区?

svn - 同时使用 Git 和 SVN

javascript - 部署到 Heroku 时异步功能不起作用

ruby-on-rails - 在 Rails/Cloudfront/Heroku 中设置 Assets 缓存过期

node.js - '找不到该进程类型' heroku Node 部署