Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 由于公钥,推送到github时权限被拒绝_Ruby On Rails_Git_Github_Ssh_Ssh Keys - Fatal编程技术网

Ruby on rails 由于公钥,推送到github时权限被拒绝

Ruby on rails 由于公钥,推送到github时权限被拒绝,ruby-on-rails,git,github,ssh,ssh-keys,Ruby On Rails,Git,Github,Ssh,Ssh Keys,我正在尝试将存储库推送到github。我已经成功地把它推给了heroku。当我键入git push origin master时,我得到以下信息: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. heroku https://gi

我正在尝试将存储库推送到github。我已经成功地把它推给了heroku。当我键入
git push origin master
时,我得到以下信息:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
heroku  https://git.heroku.com/marketvault.git (fetch)
heroku  https://git.heroku.com/marketvault.git (push)
origin  git@github.com:codeundercoverdev/marketlaunch.git (fetch)
origin  git@github.com:codeundercoverdev/marketlaunch.git (push)
我正在将代码推送到许多其他github存储库,因此我知道这不是我的计算机的一般问题,我不想更改我计算机上的默认设置。当我键入git remote-v时,我得到以下信息:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
heroku  https://git.heroku.com/marketvault.git (fetch)
heroku  https://git.heroku.com/marketvault.git (push)
origin  git@github.com:codeundercoverdev/marketlaunch.git (fetch)
origin  git@github.com:codeundercoverdev/marketlaunch.git (push)
我该如何解决这个问题?我已经尝试过这篇文章:

但他们提到的每件事都涉及到更改我整个计算机上的设置,而我的计算机对于我目前在GitHub上拥有的至少20个其他应用程序来说工作正常

更新:

运行
ssh-tvv的结果git@github.com验证

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to github.com [192.30.252.128] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/Users/davidm/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /Users/davidm/.ssh/id_rsa type 1
debug1: identity file /Users/davidm/.ssh/id_rsa-cert type -1
debug1: identity file /Users/davidm/.ssh/id_dsa type -1
debug1: identity file /Users/davidm/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "github.com" from file "/Users/davidm/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /Users/davidm/.ssh/known_hosts:4
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,ssh-dss-cert-v01@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.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: ecdh-sha2-nistp256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-dss,ssh-rsa
debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc
debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc
debug2: kex_parse_kexinit: hmac-sha1,hmac-sha2-256,hmac-sha2-512
debug2: kex_parse_kexinit: hmac-sha1,hmac-sha2-256,hmac-sha2-512
debug2: kex_parse_kexinit: none,zlib,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib,zlib@openssh.com
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_setup: found hmac-sha1
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug2: mac_setup: found hmac-sha1
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug2: dh_gen_key: priv key bits set: 159/320
debug2: bits set: 1048/2048
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug3: load_hostkeys: loading entries for host "github.com" from file "/Users/davidm/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /Users/davidm/.ssh/known_hosts:4
debug3: load_hostkeys: loaded 1 keys
debug3: load_hostkeys: loading entries for host "192.30.252.128" from file "/Users/davidm/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /Users/davidm/.ssh/known_hosts:4
debug3: load_hostkeys: loaded 1 keys
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /Users/davidm/.ssh/known_hosts:4
debug2: bits set: 1020/2048
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: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /Users/davidm/.ssh/id_rsa (0x7fb6fb416190),
debug2: key: /Users/davidm/.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: Offering RSA public key: /Users/davidm/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/davidm/.ssh/id_dsa
debug3: no such identity: /Users/davidm/.ssh/id_dsa: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).

确保您的私钥生成的公钥与在github上分配给您的帐户的公钥相同:

ssh-keygen -yf ~/.ssh/id_rsa

应该打印与
~/.ssh/id_rsa.pub中可用的内容相同的内容,并且应该在
ssh-tvv的输出后打印相同的内容git@github.com验证
OK,运行它即可。我马上就要发了。这些信息都不是机密的,对吗?发布它意味着没有安全风险吗?没有。它只打印指纹,可能还有用户名。我发布了ssh-tvv的输出git@github.com验证根据日志,客户端向服务器发送了id_rsa,但服务器未接受。github应该使用什么密钥?当我尝试使用
id\u rsa
时,返回了一个很长的密钥。当我尝试
~/.ssh/id\u rsa.pub
时,我得到了:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@“/Users/philipgreenwald/.ssh/id_rsa.pub”的权限0644太开放。其他人不能访问您的私钥文件。此私钥将被忽略。错误权限:ignore key:/Users/philipgreenwald/.ssh/id_rsa.pub
我不想更改任何全局设置,因为git和这个github帐户都适用于我计算机上的许多其他存储库。请再次阅读并检查我的要求。啊,好的。当我使用github时,没有ssh密钥。但如果我添加一个,这不会影响我的其他github存储库吗?为什么很多存储库中只有一个会有这个问题?这取决于您如何使用其他存储库。这不是问题。但是如果您显然没有使用ssh
ssh
,那么它将不会以任何方式影响它们。