Git:不能 pull

标签 git windows-7 ssh

首先,我应该说我运行的是 Windows 7。

因此,今天早上我尝试像往常一样从我的存储库中提取数据,但我做不到。我得到了错误:

The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of know
n hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

为此,git's documentation说: Permission denied (publickkey)

现在,我不太确定如何访问 ~/.ssh 文件夹,因为我在 Windows 上(也可以在网上找到任何东西)所以我尝试运行 ssh-keygen 并按回车键。但这也不起作用。

C:\Users\Ceasar\Desktop\lemonwi.se\lw_reviews\src>ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa):
Could not create directory '//.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
open //.ssh/id_rsa failed: No such host or network path.
Saving the key failed: //.ssh/id_rsa.

此时,我尝试搜索错误,但找不到任何运气。

谁能帮我恢复从 repo 中 pull 的能力?

我怀疑这可能是 PATH 变量的问题,因为我几天前不小心删除了它们并且只恢复了我记得的内容,但我完全不确定这里发生了什么。

编辑:使用 Git Bash,我导航到 ./ssh 并制作了一个新 key 。

Ceasar@BAUTISTC-PC ~ (master)
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Ceasar/.ssh/id_rsa):
/c/Users/Ceasar/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Ceasar/.ssh/id_rsa.
Your public key has been saved in /c/Users/Ceasar/.ssh/id_rsa.pub.
The key fingerprint is:
10:b5:03:59:ec:02:18:fd:90:3c:69:1e:02:a4:93:2d Ceasar@BAUTISTC-PC

然后我将其复制到 https://github.com/account/ssh但我仍然遇到错误:

C:\Users\Ceasar\Desktop>git pull origin master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly 

运行 ssh -vT git@github.com 给我:

C:\Users\Ceasar\Desktop>ssh -vT git@github.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /.ssh/identity type -1
debug1: identity file /.ssh/id_rsa type -1
debug1: identity file /.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debia
n-5github2
debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /.ssh/identity
debug1: Trying private key: /.ssh/id_rsa
debug1: Trying private key: /.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

编辑 2:所以使用 Git Bash,我可以成功 pull ,这意味着这与 Windows 不知道主目录在哪里有关。尽管根据以下内容,Windows 并未明确具有 home 变量:http://en.wikipedia.org/wiki/Environment_variable#Default_Values_on_Microsoft_Windows所以我还是有点困惑。

最佳答案

管理您的 windows 环境变量并添加 'home' -> 'c:\users\your-windows-account'。 重新启动命令控制台。

关于Git:不能 pull ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6903086/

相关文章:

linux - 在 shell 脚本中使用 ssh 连接的 mysqldump

GitLab SSH 权限被拒绝(公钥)

git - 在公共(public)特性分支中使用 git rebase

wpf - Windows 7 和 Windows 8 桌面 WPF 触摸和鼠标 LeftButtonDown 事件处理差异

windows-7 - 如何为命令提示符分配快捷键以便它可以打开多个窗口?

bash - sed命令无法通过SSH使用

linux - 版本控制软件将保留 POSIX FS (ext3/ext4) 中的所有文件及其元数据

ruby - Gitlab 配置问题::NGINX Unicorn 端口冲突

visual-studio-2013 - win7构建google or-tools报错

php - 无法杀死 PHP 脚本