我的Git安装总是指向错误的目录。为什么? [英] My Git installation always refers to the wrong directory. Why?

查看:388
本文介绍了我的Git安装总是指向错误的目录。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我多次在我的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(推送)
C:\IntelliJ IDEA 12.1.4\workspace\signup-sheet> git push heroku master
无法创建目录'/ C / GIT中/的.ssh。
主机'heroku.com(__.__.__。156)'的真实性无法建立。
RSA密钥指纹是8b:48:5e:00:0e:00:16:00:32:00:87:0c:00:c8:60:ad。
您确定要继续连接(是/否)吗? yes
无法将主机添加到已知主机列表(/c/Git/.ssh/known_hosts)。
权限被拒绝(publickey)。
致命:无法从远程存储库读取。

另外,

  C:\IntelliJ IDEA 12.1.4 \workspace\signup-sheet> git config --global user.emaildjangofan@gmail.com
错误:无法锁定配置文件C :\Git / .gitconfig:没有这样的文件或目录


解决方案

这与环境变量 HOME 的值有关。



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

  @if不存在%HOME%@set HOME =%HOMEDRIVE %% HOMEPATH%
@如果不存在%HOME%@set HOME =%USERPROFILE%

使用新的git-for -window, git.exe 构建于:

   - CD-到户; WorkingDir:%HOMEDRIVE %% HOMEPATH%

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


I installed and re-installed Git on my Windows8 machine multiple times. It's a long story as to why I did that. Once I installed it at C:\Git and now I have it installed at C:\Program Files (x86)\Git and now I am having Git configuration problems. My Git configuration is unable to write security credentials to Git configuration files because it thinks they are in a location that no longer exists (C:\Git).

Because of this, I always resort to using the GitHub GUI, but that wont work with Heroku. So now I need help.

For example, when trying to push code to Heroku I get:

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.

Also,

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

解决方案

This is linked to the value of the environment variable HOME.

With the old msysgit, that git-cmd.bat contains:

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

With the new git-for-windows, the git.exe is build with:

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

In both cases, HOME is set to, by default, %HOMEDRIVE%%HOMEPATH%.

这篇关于我的Git安装总是指向错误的目录。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆