我想尝试在我的常规Windows提示符中使用git,而不是在Git中使用。原因很简单,我可以使用IntelliJ提供的终端。我以为这是一个1分钟的修正,但我想不是。
当我尝试git pull origin <branch>时,我会得到以下错误消息:
C:\Users\Username\Documents\Bitbucket\java-project>git pull
Could not create directory '/c/Username/.ssh'.
The authenticity of host 'bitbucket.org (131.103.20.167)' can't be established.
RSA key fingerprint is 12:8c:1b:f2:6d:14:6b:5c:3b:ec:aa:46:46:xy:7c:40.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/c/Username/.ssh/known_hosts).
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.我已经对现有的.ssh文件夹设置了权限,以便所有用户都可以完全访问、管理员和系统。所以这应该没问题。
我还试着以管理员的身份运行提示,看看这是否是问题所在,但也不是这样。
我现在注意到的是,上面写着:Could not create directory '/c/Username/.ssh'.。但是,我的.ssh目录位于C:\Users\Username\.ssh。那么我可能需要改变我的配置。
Git版本: 1.9.0.msysgit.0 Windows版本:Windows8.1
发布于 2014-06-01 08:10:04
首先,使用msysgit 1.9.2进行测试,当您选择在安装期间使git命令从cmd.exe中可用(在其他选择中,只在git下使其可用,或者使所有MSYS命令在cmd.exe下可用),git clone将从cmd.exe提示符中工作。
ssh客户端使用HOME环境变量查找.ssh/目录,但是git应该处理所有丑陋的细节。您不应该在正常的Windows环境中定义HOME,因此如果echo %HOME%在cmd.exe提示符中打印路径,编辑OS环境变量并删除HOME。
如果这不能解决这个问题,卸载和安装最新版本可能会有所帮助。
最后,您有像C:UsersUsername这样的路径,这可能意味着您在某个地方遗漏了引号。在git bash中,尝试以下两个命令:
echo C:\Users\Username
echo 'C:\Users\Username'发布于 2014-06-01 06:13:47
请确保键入您的cmd会话,即每个git-cmd.bat都附带的用于Windows的Git msysgit版本。
这将将您的HOME设置为%USERPROFILE%,应该是C:\Users\Username。
但是,请确保没有使用不正确的值定义的环境变量HOME:如果是这样的话,请取消设置它。
发布于 2022-02-08 15:43:41
https://stackoverflow.com/questions/23974739
复制相似问题