I've read most of the related issues and tried most of the solutions but nothing has worked for me.
I have installed Rails and Git through RailsInstaller and I'm trying to upload my rails application into heroku from Windows 7 but I keep getting Permission denied (publickey) although my keys are uploaded into heroku.
Here is the log of how I've tried uploading my ssh keys the last time:
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
Can anyone see what I'm doing wrong or has any suggestions?
Update
Here are some more details on what log i get when i runshh on verbose
$ 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).
Thanks in advance
Make sure you only have /c/Users/firstname.lastname/.ssh your public and private keys id_rsa and id_rsa.pub (no id_dsa file)
Even if your key has been uploaded to heroku, double-check that heroku keys:add see your public keys (heroku key management), and recognized it already had been published on Heroku side. (And that it is the right one)
Make sure the environment variable HOME is set at all time to /c/Users/firstname.lastname in your git-bash session.
Make sure your ssh keys aren't passphrase protected (at first, for testing) and that you don't have an ssh agent which might get confused with the ssh key used: see "Unable to push git repo to Heroku, despite valid SSH keys".
you can also try and reset the keys.
Git doesn't know where your SSH keys are. You need to put them into
C:/Program Files/Git/.ssh/
C:/Program Files/Git/.ssh/
or
C:/Program Files (x86)/Git/.ssh/
C:/Program Files (x86)/Git/.ssh/
only then the Git bash will recognize the keys.
Related
I am using capistrano in order to deploy several projects to a VPS. I keep my remote repo in this case on bitbucket. This configuration has been working for years.
I have forwarding configured in my deploy.rb:
set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/SOMEKEY_rsa) }
Suddenly I am unable to deploy or deploy:check all projects from all my local machines. The only thing, that changed is, that I had to change the hostname of the VPS some time ago. And some days ago I corrected a related configuration error by correcting the new hostname entry in my VPS admin page. Could the new hostname be the cause for the error?
This is the output I receive when running a deploy:check
% cap production deploy:check
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
ruby-3.0.0
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
00:00 git:wrapper
01 mkdir -p /tmp
✔ 01 SOMEUSER#IP.IP.IP.IP 0.120s
Uploading /tmp/git-ssh-c9068d67cac423341809.sh 100.0%
02 chmod 700 /tmp/git-ssh-c9068d67cac423341809.sh
✔ 02 SOMEUSER#IP.IP.IP.IP 0.119s
00:00 git:check
01 git ls-remote git#bitbucket.org:GITUSER/SOMEREPO.git HEAD
01 git#bitbucket.org: Permission denied (publickey).
01
01 fatal: Could not read from remote repository.
01
01
01 Please make sure you have the correct access rights
01 and the repository exists.
#<Thread:0x00007f8a868e0568 /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
/Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing on host IP.IP.IP.IP: git exit status: 128 (SSHKit::Runner::ExecuteError)
git stdout: git#bitbucket.org: Permission denied (publickey).\r\r
fatal: Could not read from remote repository.\r
\r
Please make sure you have the correct access rights\r
and the repository exists.
git stderr: Nothing written
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/command.rb:97:in `exit_status=': git exit status: 128 (SSHKit::Command::Failed)
git stdout: git#bitbucket.org: Permission denied (publickey).\r\r
fatal: Could not read from remote repository.\r
\r
Please make sure you have the correct access rights\r
and the repository exists.
git stderr: Nothing written
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/backends/netssh.rb:170:in `execute_command'
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
from <internal:kernel>:90:in `tap'
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:80:in `execute'
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/capistrano-3.17.1/lib/capistrano/scm/git.rb:83:in `git'
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/capistrano-3.17.1/lib/capistrano/scm/git.rb:40:in `check_repo_is_reachable'
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/capistrano-3.17.1/lib/capistrano/scm/tasks/git.rake:19:in `block (4 levels) in eval_rakefile'
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:100:in `with'
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/capistrano-3.17.1/lib/capistrano/scm/tasks/git.rake:18:in `block (3 levels) in eval_rakefile'
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `run'
from /Users/SOMEUSER/.rvm/gems/ruby-SOMEVERSION#SOMEPROJECT/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host IP.IP.IP.IP: git exit status: 128
git stdout: git#bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
git stderr: Nothing written
Caused by:
SSHKit::Command::Failed: git exit status: 128
git stdout: git#bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
git stderr: Nothing written
Tasks: TOP => deploy:check => git:check
(See full trace by running task with --trace)
I can push and pull to my remote git repo on bitbucket, but apparently capistrano cannot connect to it during the deployment process.
What key (from my machine, from the VPS) is missing where (on the VPS, on bitbucket)?
How can I solve this error?
UPDATE 1:
I can connect to bitbucket from my dev system, but not from the VPS.
Currently I have no keys configured on the VPS. I do not remember, if there were some and they gor deleted when I changed the hostname. I assumed capistrano used the keys from my dev machine for the whole process.
This is the output of running ssh -Tvvv git#bitbucket.org on the vps:
% ssh -Tvvv git#bitbucket.org
OpenSSH_8.2p1 Ubuntu-4ubuntu0.4, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "bitbucket.org" port 22
debug2: ssh_connect_direct
debug1: Connecting to bitbucket.org [SOMEIP] SOMEPORT.
debug1: Connection established.
debug1: identity file /home/SOMEUSER/.ssh/id_rsa type -1
debug1: identity file /home/SOMEUSER/.ssh/id_rsa-cert type -1
debug1: identity file /home/SOMEUSER/.ssh/id_dsa type -1
debug1: identity file /home/SOMEUSER/.ssh/id_dsa-cert type -1
debug1: identity file /home/SOMEUSER/.ssh/id_ecdsa type -1
debug1: identity file /home/SOMEUSER/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/SOMEUSER/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/SOMEUSER/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/SOMEUSER/.ssh/id_ed25519 type -1
debug1: identity file /home/SOMEUSER/.ssh/id_ed25519-cert type -1
debug1: identity file /home/SOMEUSER/.ssh/id_ed25519_sk type -1
debug1: identity file /home/SOMEUSER/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/SOMEUSER/.ssh/id_xmss type -1
debug1: identity file /home/SOMEUSER/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.4
debug1: Remote protocol version 2.0, remote software version conker_a97b73fe8d f80d5e4fabac
debug1: no match: conker_a97b73fe8d f80d5e4fabac
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to bitbucket.org:22 as 'git'
debug3: hostkeys_foreach: reading file "/home/SOMEUSER/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /home/SOMEUSER/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from bitbucket.org
debug3: order_hostkeyalgs: prefer hostkeyalgs: rsa-sha2-512-cert-v01#openssh.com,rsa-sha2-256-cert-v01#openssh.com,ssh-rsa-cert-v01#openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256#libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: rsa-sha2-512-cert-v01#openssh.com,rsa-sha2-256-cert-v01#openssh.com,ssh-rsa-cert-v01#openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256-cert-v01#openssh.com,ecdsa-sha2-nistp384-cert-v01#openssh.com,ecdsa-sha2-nistp521-cert-v01#openssh.com,sk-ecdsa-sha2-nistp256-cert-v01#openssh.com,ssh-ed25519-cert-v01#openssh.com,sk-ssh-ed25519-cert-v01#openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256#openssh.com,ssh-ed25519,sk-ssh-ed25519#openssh.com
debug2: ciphers ctos: chacha20-poly1305#openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,aes256-gcm#openssh.com
debug2: ciphers stoc: chacha20-poly1305#openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,aes256-gcm#openssh.com
debug2: MACs ctos: umac-64-etm#openssh.com,umac-128-etm#openssh.com,hmac-sha2-256-etm#openssh.com,hmac-sha2-512-etm#openssh.com,hmac-sha1-etm#openssh.com,umac-64#openssh.com,umac-128#openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm#openssh.com,umac-128-etm#openssh.com,hmac-sha2-256-etm#openssh.com,hmac-sha2-512-etm#openssh.com,hmac-sha1-etm#openssh.com,umac-64#openssh.com,umac-128#openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib#openssh.com,zlib
debug2: compression stoc: none,zlib#openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256#libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,ext-info-s
debug2: host key algorithms: ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss
debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,chacha20-poly1305#openssh.com
debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,chacha20-poly1305#openssh.com
debug2: MACs ctos: hmac-sha2-256-etm#openssh.com,hmac-sha2-256,hmac-sha1,hmac-sha1-96
debug2: MACs stoc: hmac-sha2-256-etm#openssh.com,hmac-sha2-256,hmac-sha1,hmac-sha1-96
debug2: compression ctos: none
debug2: compression stoc: none
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256#libssh.org
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ssh-rsa SOMESTUFF:SOMESTUFF
debug3: hostkeys_foreach: reading file "/home/SOMEUSER/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /home/SOMEUSER/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from bitbucket.org
debug3: hostkeys_foreach: reading file "/home/SOMEUSER/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /home/SOMEUSER/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys from SOMEIP
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /home/SOMEUSER/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/SOMEUSER/.ssh/id_rsa
debug1: Will attempt key: /home/SOMEUSER/.ssh/id_dsa
debug1: Will attempt key: /home/SOMEUSER/.ssh/id_ecdsa
debug1: Will attempt key: /home/SOMEUSER/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/SOMEUSER/.ssh/id_ed25519
debug1: Will attempt key: /home/SOMEUSER/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/SOMEUSER/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa-cert-v01#openssh.com,ecdsa-sha2-nistp384-cert-v01#openssh.com,ssh-rsa,rsa-sha2-512,ecdsa-sha2-nistp521-cert-v01#openssh.com,ecdsa-sha2-nistp256-cert-v01#openssh.com,rsa-sha2-256,ssh-dss-cert-v01#openssh.com>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred gssapi-with-mic,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: /home/SOMEUSER/.ssh/id_rsa
debug3: no such identity: /home/SOMEUSER/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /home/SOMEUSER/.ssh/id_dsa
debug3: no such identity: /home/SOMEUSER/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/SOMEUSER/.ssh/id_ecdsa
debug3: no such identity: /home/SOMEUSER/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/SOMEUSER/.ssh/id_ecdsa_sk
debug3: no such identity: /home/SOMEUSER/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: /home/SOMEUSER/.ssh/id_ed25519
debug3: no such identity: /home/SOMEUSER/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /home/SOMEUSER/.ssh/id_ed25519_sk
debug3: no such identity: /home/SOMEUSER/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /home/SOMEUSER/.ssh/id_xmss
debug3: no such identity: /home/SOMEUSER/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
git#bitbucket.org: Permission denied (publickey).
UPDATE 2:
When I try to check ssh on the vps I get:
% ssh-add -l
Could not open a connection to your authentication agent.
% ssh-add
Could not open a connection to your authentication agent.
% eval `ssh-agent -s`
Agent pid 449351
% ssh-add -l
The agent has no identities.
UPDATE 3
Apparently on two of my machines, both run macOS Monterey 12.6.2, ssh identities are not loaded anymore after system boot.
I was able to solve the issue for now ... at least it is currently working.
I generated new keys on the VPS and added them on bitbucket, but what finally seems to have worked is adding my local key id_rsa again to ssh. After doing so on two machines, the process is currently working on both and I can deploy again.
I do not know, why they got disabled.
I am having trouble connecting Rails webapp to Amazon AWS codedeploy this is the result of:
pachanga:~/workspace (master) $ ssh -v deploy#13.59.79.103
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/ubuntu/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 13.59.79.103 [13.59.79.103] port 22.
debug1: Connection established.
debug1: identity file /home/ubuntu/.ssh/id_rsa type 1
debug1: identity file /home/ubuntu/.ssh/id_rsa-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_dsa type -1
debug1: identity file /home/ubuntu/.ssh/id_dsa-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_ecdsa type -1
debug1: identity file /home/ubuntu/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_ed25519 type -1
debug1: identity file /home/ubuntu/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.2 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1-etm#openssh.com none
debug1: kex: client->server aes128-ctr hmac-sha1-etm#openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 28:6c:c4:0c:e8:86:ee:c1:70:4e:35:cf:b3:29:86:61
debug1: Host '13.59.79.103' is known and matches the ECDSA host key.
debug1: Found key in /home/ubuntu/.ssh/known_hosts:17
debug1: ssh_ecdsa_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: Offering RSA public key: /home/ubuntu/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/ubuntu/.ssh/id_dsa
debug1: Trying private key: /home/ubuntu/.ssh/id_ecdsa
debug1: Trying private key: /home/ubuntu/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
I am following a tutorial here the tutorial
I have authorized_keys and it has the does have the ssh in it.
I found it
the vi editor was deleting the first character in the ssh
I am trying to push a repository to github. I have already succesfully pushed it to heroku. When I type git push origin master I get the following:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I am pushing code to many other github repositories so I know it is not a general issue with my computer and I don't want to change default settings on my computer. When I type git remote -v I get the following:
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)
How do I fix this? I've already tried this article:
GitHub Error Message - Permission denied (publickey)
but everything they mention involves changing settings on my entire computer, whereas my computer works fine for the atleast 20 other applications I currently have on GitHub.
UPDATE:
The results of running ssh -Tvvv git#github.com verify:
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).
Make sure your private key generates the same public key as is assigned to your account on github:
ssh-keygen -yf ~/.ssh/id_rsa
should print the same thing that is available in your ~/.ssh/id_rsa.pub and the same content should be in your github account.
So i have tried everything i can find and im panicing so please help
When i do a fresh heroku create on my app it genirates fine
then i go to git push heroku master.
I get the error
Jacks-MacBook-Air:morph jacksharville$ 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.
i have tried clear the keys with heroku keys:clear
I have then tried running heroku keys:add
It still comes up with the same error.
if i run ssh -vT git#heroku.com
this is the output
Jacks-MacBook-Air:morph jacksharville$ ssh -vT git#heroku.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 *
debug1: Connecting to heroku.com [50.19.85.154] port 22.
debug1: Connection established.
debug1: identity file /Users/jacksharville/.ssh/id_rsa type 1
debug1: identity file /Users/jacksharville/.ssh/id_rsa-cert type -1
debug1: identity file /Users/jacksharville/.ssh/id_dsa type -1
debug1: identity file /Users/jacksharville/.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 endosome
debug1: no match: endosome
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: RSA 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /Users/jacksharville/.ssh/known_hosts:3
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/jacksharville/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to heroku.com ([194.168.4.123]:53).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_GB.UTF-8
shell request failed on channel 0
What happens if you do heroku auth:login and then log in with your credentials?
Do you still get the same error?
There is no way to fix this easily. The way i ended up getting around it is creating a new app and dragging assets across.
I've googled the heck out of this one, and it is still failing me.
ssh: Could not resolve hostname github: Name or service not known
fatal: The remote end hung up unexpectedly
Most of the problems with this seem to do with having the wrong keys being sent to the server,
which isn't the problem. I can SSH into github as stated in github's help pages. I did have this working fine before, but I had wiped out the repository, wiped out my keys, and started fresh.
Here is the output of ssh -v git#github.com:
OpenSSH_5.5p1 Debian-4ubuntu5, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /home/patrick/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/patrick/.ssh/id_rsa-cert type -1
debug1: identity file /home/patrick/.ssh/id_dsa type -1
debug1: identity file /home/patrick/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-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_5.5p1 Debian-4ubuntu5
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr 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 /home/patrick/.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: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/patrick/.ssh/id_rsa
debug1: Remote: Forced command: gerve blueshift9
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Remote: Forced command: gerve blueshift9
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions#openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.utf8
PTY allocation request failed on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow#openssh.com reply 0
Hi! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Connection to github.com closed.
Transferred: sent 2648, received 2904 bytes, in 0.1 seconds
Bytes per second: sent 37663.4, received 41304.6
debug1: Exit status 1
Thanks!
what exactly are you doing to get this error? it suggests you're trying to connect to git#github, not git#github.com
ssh: Could not resolve hostname github: Name or service not known fatal: The remote end hung up unexpectedly
this means there is nothing wrong with your keys:
debug1: Authentication succeeded (publickey).
...
Hi! You've successfully authenticated, but GitHub does not provide shell access.