gpt4 book ai didi

ruby-on-rails - 权限被拒绝(公钥)。致命的 : Could not read from remote repository

转载 作者:可可西里 更新时间:2023-11-01 14:37:48 26 4
gpt4 key购买 nike

我已经阅读了大部分相关问题并尝试了大部分解决方案,但没有任何效果。

我已经通过 RailsInstaller 安装了 Rails 和 Git,我正在尝试将我的 Rails 应用程序从 Windows 7 上传到 heroku,但我一直收到 Permission denied (publickey) 虽然我的 key 已上传到 heroku。

这是我上次尝试上传 ssh key 的日志:

firstname.lastname@LONMAX-LTETB9X /c/Users/firstname.lastname/mytinyurl
(master)
$ heroku keys:clear
Removing all SSH keys... done

firstname.lastname@LONMAX-LTETB9X /c/Users/firstname.lastname/mytinyurl
(master)
$ heroku login
Enter your Heroku credentials.
Email: email@yahoo.com
Password (typing will be hidden):
Could not find an existing public key.
Would you like to generate one? [Yn] Y
Generating new SSH public key.
Uploading SSH public key C:/Users/firstname.lastname/.ssh/id_rsa.pub... done
Authentication successful.

firstname.lastname@LONMAX-LTETB9X /c/Users/firstname.lastname/mytinyurl
(master)
$ git init
Reinitialized existing Git repository in c:/Users/firstname.lastname/myti
nyurl/.git/

firstname.lastname@LONMAX-LTETB9X /c/Users/firstname.lastname/mytinyurl
(master)
$ git add .

firstname.lastname@LONMAX-LTETB9X /c/Users/firstname.lastname/mytinyurl
(master)
$ git commit -m "first"
On branch master
nothing to commit, working directory clean

firstname.lastname@LONMAX-LTETB9X /c/Users/firstname.lastname/mytinyurl
(master)
$ git push heroku master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

firstname.lastname@LONMAX-LTETB9X /c/Users/firstname.lastname/mytinyurl
(master)
$ heroku keys
=== email@yahoo.com Keys
ssh-rsa AAAAB3NzaC...rJqQanPQ== firstname.lastname@LONMAX-LTETB9X

谁能看出我做错了什么或有什么建议?

更新

这里有一些关于我在 verbose 上运行 shh 时得到的日志的更多详细信息

 $ ssh -vvv git@heroku.com

OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug2: ssh_connect: needpriv 0
debug1: Connecting to heroku.com [50.19.85.132] port 22.
debug1: Connection established.
debug1: identity file /h/.ssh/identity type -1
debug3: Not a RSA1 key file /h/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /h/.ssh/id_rsa type 1
debug1: identity file /h/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version Twisted
debug1: no match: Twisted
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-g
roup-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour1
28,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-c
tr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour1
28,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-c
tr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@open
ssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@open
ssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa
debug2: kex_parse_kexinit: aes256-ctr,aes256-cbc,aes192-ctr,aes192-cbc,aes128-ct
r,aes128-cbc,cast128-ctr,cast128-cbc,blowfish-ctr,blowfish-cbc,3des-ctr,3des-cbc

debug2: kex_parse_kexinit: aes256-ctr,aes256-cbc,aes192-ctr,aes192-cbc,aes128-ct
r,aes128-cbc,cast128-ctr,cast128-cbc,blowfish-ctr,blowfish-cbc,3des-ctr,3des-cbc

debug2: kex_parse_kexinit: hmac-sha1,hmac-md5
debug2: kex_parse_kexinit: hmac-sha1,hmac-md5
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug2: dh_gen_key: priv key bits set: 133/256
debug2: bits set: 529/1024
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug3: check_host_in_hostfile: filename /h/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug3: check_host_in_hostfile: filename /h/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 3
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /h/.ssh/known_hosts:1
debug2: bits set: 499/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /h/.ssh/identity (0x0)
debug2: key: /h/.ssh/id_rsa (0xa01a528)
debug2: key: /h/.ssh/id_dsa (0x0)
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /h/.ssh/identity
debug3: no such identity: /h/.ssh/identity
debug1: Offering public key: /h/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: fp ac:2f:88:b3:69:96:c5:f4:ba:f6:f6:9d:e6:ea:8f:cf

debug3: sign_and_send_pubkey
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: Trying private key: /h/.ssh/id_dsa
debug3: no such identity: /h/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).

提前致谢

最佳答案

确保你只有 /c/Users/firstname.lastname/.ssh 你的公钥和私钥 id_rsaid_rsa.pub (没有 id_dsa 文件)

即使您的 key 已上传到 heroku,double-check that heroku keys:add查看您的公钥(heroku key management),并认识到它已经在 Heroku 端发布。 (和 that it is the right one )

确保环境变量 HOME 在您的 git-bash session 中始终设置为 /c/Users/firstname.lastname

确保您的 ssh key 不受密码保护(首先,用于测试)并且您没有 ssh 代理,这可能会与所使用的 ssh key 混淆:参见“Unable to push git repo to Heroku, despite valid SSH keys”。

你也可以try and reset the keys .

关于ruby-on-rails - 权限被拒绝(公钥)。致命的 : Could not read from remote repository,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24651874/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com