Net::SCP scp exited with non-success state: 256 at test.pl line 27 - perl

I have searched all the internet for this code of error. The only place left is your human minds.
Here's my code:
#!/usr/bin/perl
use strict;
use Net::FTP;
use Net::SCP;
use Net::SCP::Expect;
my $ip = "192.168.141.131";
my $username = "user_backup";
my $password = "ubuntu";
my $tfr_type = "scp";
my $file = "/home/osboxes/Desktop/ConteudosServer/backupsystem/backups/Fri_11_Dec_21.18.14_i‌​_2015";
my $dest = "/home/user_backup/backups/aqui.txt";
my $scp = Net::SCP::Expect->new(
host => $ip,
user => $username,
password => $password,
auto_yes => 1,
verbose => 1,
debug => 1,
timeout_auto => 1,
);
$scp->scp($file, $dest);
print "Source: $file\n";
print "Desti: $dest\n";
I don't where it goes wrong. It says line 26: $scp->scp($file, $dest); but I don't know where it is wrong.
EDIT
As Kenster's sugested (thank you bro) here is the scp -v /home/osboxes/Desktop/ConteudosServer/backupsystem/backups/Fri_11_Dec_21.18.14_i_2015 user_backup#192.168.141.131:/home/user_backup/backups/aqui.txt > /tmp/rapid.txt command:
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.141.131 [192.168.141.131] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Ubuntu-5ubuntu1.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr umac-64-etm#openssh.com none
debug1: kex: client->server aes128-ctr umac-64-etm#openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 30:af:e0:62:a2:cd:f9:e0:ae:43:2a:d8:b9:b3:e5:72
debug1: Host '192.168.141.131' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:2
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,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Next authentication method: password
user_backup#192.168.141.131's password:
debug1: Authentication succeeded (password).
Authenticated to 192.168.141.131 ([192.168.141.131]:22).
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_GB.UTF-8
debug1: Sending command: scp -v -t /home/user_backup/backups/aqui.txt
Sending file modes: C0644 104540 Fri_11_Dec_21.18.14_i_2015
Sink: C0644 104540 Fri_11_Dec_21.18.14_i_2015
scp: /home/user_backup/backups/aqui.txt: Permission denied
root#osboxes:/home/osboxes/Desktop/ConteudosServer/backupsystem# debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 2636, received 2344 bytes, in 0.2 seconds
Bytes per second: sent 12676.0, received 11271.8
debug1: Exit status 1

Related

Why can't I connect to github with my ssh key on yubikey

I have an SSH key generated on my desktop as well as one generated on my yubikey. Both are ED25519 keys, with the one on the yubikey being an ED25519-sk for the security key. When I run "ssh -t git#github.com" to attempt to connect to github to test the ssh key with the desktop key it works just fine and connects successfully. However when I load in the SK from the yubikey and attempt to connect I get permission denied. I have properly added both keys to my github account as well as to the ssh-agent. I've run out of ideas of what could be wrong??
Here are my debug logs:
$ ssh -tv git#github.com
OpenSSH_9.0p1, OpenSSL 1.1.1q 5 Jul 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [140.82.113.3] port 22.
debug1: Connection established.
debug1: identity file /c/Users/USER/.ssh/id_rsa type -1
debug1: identity file /c/Users/USER/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/USER/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/USER/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/USER/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/USER/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/USER/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/USER/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/USER/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/USER/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/USER/.ssh/id_xmss type -1
debug1: identity file /c/Users/USER/.ssh/id_xmss-cert type -1
debug1: identity file /c/Users/USER/.ssh/id_dsa type -1
debug1: identity file /c/Users/USER/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.0
debug1: Remote protocol version 2.0, remote software version babeld-adca5b9e
debug1: compat_banner: no match: babeld-adca5b9e
debug1: Authenticating to github.com:22 as 'git'
debug1: load_hostkeys: fopen /c/Users/USER/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
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
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU
debug1: load_hostkeys: fopen /c/Users/USER/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'github.com' is known and matches the ED25519 host key.
debug1: Found key in /c/Users/USER/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: agent returned 1 keys
debug1: Will attempt key: ED25519-SK ********************************** authenticator agent
debug1: Will attempt key: /c/Users/USER/.ssh/id_rsa
debug1: Will attempt key: /c/Users/USER/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/USER/.ssh/id_ecdsa_sk
debug1: Will attempt key: /c/Users/USER/.ssh/id_ed25519
debug1: Will attempt key: /c/Users/USER/.ssh/id_ed25519_sk
debug1: Will attempt key: /c/Users/USER/.ssh/id_xmss
debug1: Will attempt key: /c/Users/USER/.ssh/id_dsa
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01#openssh.com,ecdsa-sha2-nistp521-cert-v01#openssh.com,ecdsa-sha2-nistp384-cert-v01#openssh.com,ecdsa-sha2-nistp256-cert-v01#openssh.com,sk-ssh-ed25519-cert-v01#openssh.com,sk-ecdsa-sha2-nistp256-cert-v01#openssh.com,rsa-sha2-512-cert-v01#openssh.com,rsa-sha2-256-cert-v01#openssh.com,ssh-rsa-cert-v01#openssh.com,sk-ssh-ed25519#openssh.com,sk-ecdsa-sha2-nistp256#openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: ED25519-SK ********************************** authenticator agent
debug1: Server accepts key: ED25519-SK ********************************** authenticator agent
sign_and_send_pubkey: signing failed for ED25519-SK "" from agent: agent refused operation
debug1: Trying private key: /c/Users/USER/.ssh/id_rsa
debug1: Trying private key: /c/Users/USER/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/USER/.ssh/id_ecdsa_sk
debug1: Trying private key: /c/Users/USER/.ssh/id_ed25519
debug1: Trying private key: /c/Users/USER/.ssh/id_ed25519_sk
debug1: Trying private key: /c/Users/USER/.ssh/id_xmss
debug1: Trying private key: /c/Users/USER/.ssh/id_dsa
debug1: No more authentication methods to try.
git#github.com: Permission denied (publickey).
"ssh -t git#github.com" to attempt to connect to github to test the ssh key with the desktop key it works just fine and connects successfully.
From your log, the test is not successful, since you should see a Welcome message:
Hi USERNAME!
You've successfully authenticated, but GitHub does not provide shell access.
Double-check "Security keys are now supported for SSH Git operations", and if your security key supports FIDO2 resident keys, consider using a resident key.
For your test to use your ED25519-sk, try and force it with:
ssh -i ~/.ssh/id_ecdsa_sk git#github.com
Note that you might need Git for Windows 2.39-rc1, which states:
It is now possible to generate and use SSH keys protected by security keys (AKA FIDO devices) via Windows Hello, e.g. via ssh-keygen.exe -t ecdsa-sk.
(Just in case "libfido2 upgraded to v0.12.0" could bring any benefit to your current command)

github----git#github.com: Permission denied (publickey,password)

I google online to find the solution and tried as this link https://docs.github.com/cn/authentication/troubleshooting-ssh/error-permission-denied-publickey
But it didn't work.
When I type ssh -vT git#github.com, the result:
OpenSSH_8.2p1 Ubuntu-4ubuntu0.4, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /home/zetlin/.ssh/config
debug1: /home/zetlin/.ssh/config line 1: Applying options for github.com
debug1: /home/zetlin/.ssh/config line 12: Applying options for *
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 *
debug1: Connecting to github.com [141.164.49.108] port 22.
debug1: Connection established.
debug1: identity file /home/zetlin/.ssh/id_github type 0
debug1: identity file /home/zetlin/.ssh/id_github-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 OpenSSH_8.4p1 Ubuntu-6ubuntu2.1
debug1: match: OpenSSH_8.4p1 Ubuntu-6ubuntu2.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
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
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:UIDrRc6***************sgm7HpmED92IuKCo
debug1: Host 'github.com' is known and matches the ECDSA host key.
debug1: Found key in /home/zetlin/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/zetlin/.ssh/id_github RSA SHA256:7O+NeSr******************1A8rOv6l+amG9s explicit agent
debug1: Will attempt key: Zelin_Xu#********.com RSA SHA256:cc95TN**********************N9E61y1Z9kbGA agent
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519#openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256#openssh.com,webauthn-sk-ecdsa-sha2-nistp256#openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/zetlin/.ssh/id_github RSA SHA256:7O+NeSr*****************1A8rOv6l+amG9s explicit agent
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: Zelin_Xu#*********.com RSA SHA256:cc95TN*******************9E61y1Z9kbGA agent
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
git#github.com: Permission denied (publickey,password).
When type ssh-add -l -E sha256
the result is same as github ssh keys
I tried as here https://docs.github.com/en/authentication/troubleshooting-ssh/error-permission-denied-publickey, when type eval "$(ssh-agent -s)", then typessh-add -l -E sha256 , output is The agent has no identities.
when type ssh -T git#github.com, the terminator ask me to input the git#github.com's password: , either the password to login in the github website or the password to ssh-gen(actually no password) is not OK. Which password should I type here?
Agent pid 16629
➜ apollo git:(predtr) ssh-add -l -E sha256
The agent has no identities.
➜ apollo git:(predtr) ssh-agent bash
(base) zetlin#zetlin-HP-Z4-G4-Workstation:~/Code/github/apollo$ ssh-add ~/.ssh/id_github
Identity added: /home/zetlin/.ssh/id_github (linzexu#126.com)
(base) zetlin#zetlin-HP-Z4-G4-Workstation:~/Code/github/apollo$ ssh -T git#github.com
git#github.com's password:
Permission denied, please try again.
git#github.com's password:
Permission denied, please try again.
git#github.com's password:
git#github.com: Permission denied (publickey,password).
Update:
Follow the tips, maybe the configuration is conflicting, I delete the configure files& keys files in /etc/ssh/ssh_config & known_hosts in /home/zetlin/known_hosts, then command ssh -vT git#github.com, the result:
➜ ~ ssh -vT git#github.com
OpenSSH_8.2p1 Ubuntu-4ubuntu0.4, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /home/zetlin/.ssh/config
debug1: /home/zetlin/.ssh/config line 1: Applying options for github.com
debug1: /home/zetlin/.ssh/config line 11: Applying options for *
debug1: Connecting to github.com [141.164.49.108] port 22.
debug1: Connection established.
debug1: identity file /home/zetlin/.ssh/id_github type 0
debug1: identity file /home/zetlin/.ssh/id_github-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 OpenSSH_8.4p1 Ubuntu-6ubuntu2.1
debug1: match: OpenSSH_8.4p1 Ubuntu-6ubuntu2.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
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
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:UIDr***************************92IuKCo
debug1: Host 'github.com' is known and matches the ECDSA host key.
debug1: Found key in /home/zetlin/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/zetlin/.ssh/id_github RSA SHA256:7O+NeSr****************1A8rOv6l+amG9s explicit agent
debug1: Will attempt key: Zelin_Xu#******************.com RSA SHA256:cc95TN*****************61y1Z9kbGA agent
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519#openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256#openssh.com,webauthn-sk-ecdsa-sha2-nistp256#openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/zetlin/.ssh/id_github RSA SHA256:7O+NeSr**************Ov6l+amG9s explicit agent
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: Zelin_Xu#********.com RSA SHA256:cc95TNApI**********************1y1Z9kbGA agent
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
git#github.com's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
git#github.com's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
git#github.com's password:
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
git#github.com: Permission denied (publickey,password).
I still don't know the password
update:
I could git clone 'https' but not 'ssh'

Can't push to github with SourceTree despite having identity added in agent: Permission denied (publickey)

If I run ssh-add -l I see my identity in the list as expected. If I run ssh -vT git#github.com I get this output:
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/myself/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to github.com [140.82.113.4] port 22.
debug1: Connection established.
debug1: identity file /Users/myself/.ssh/id_rsa type -1
debug1: identity file /Users/myself/.ssh/id_rsa-cert type -1
debug1: identity file /Users/myself/.ssh/id_dsa type -1
debug1: identity file /Users/myself/.ssh/id_dsa-cert type -1
debug1: identity file /Users/myself/.ssh/id_ecdsa type -1
debug1: identity file /Users/myself/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/myself/.ssh/id_ed25519 type -1
debug1: identity file /Users/myself/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/myself/.ssh/id_xmss type -1
debug1: identity file /Users/myself/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version babeld-849b9b5f
debug1: no match: babeld-849b9b5f
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
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
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /Users/myself/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: Generated by Sourcetree on macOS for myself-GitHub RSA SHA256:WnUQPEasG3tUVyEkE7Ufo9fGoRqCdUeY9ohZ7OU6fsc agent
debug1: Will attempt key: /Users/myself/.ssh/id_rsa
debug1: Will attempt key: /Users/myself/.ssh/id_dsa
debug1: Will attempt key: /Users/myself/.ssh/id_ecdsa
debug1: Will attempt key: /Users/myself/.ssh/id_ed25519
debug1: Will attempt key: /Users/myself/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: Generated by Sourcetree on macOS for myself-GitHub RSA SHA256:WnUQPEasG3tUVyEkE7Ufo9fGoRqCdUeY9ohZ7OU6fsc agent
debug1: Server accepts key: Generated by Sourcetree on macOS for myself-GitHub RSA SHA256:WnUQPEasG3tUVyEkE7Ufo9fGoRqCdUeY9ohZ7OU6fsc agent
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([140.82.113.4]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_TERMINAL_VERSION = 3.3.8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_TERMINAL = iTerm2
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi myself! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3564, received 2484 bytes, in 0.2 seconds
Bytes per second: sent 18846.5, received 13135.4
debug1: Exit status 1
I still can't push code to github despite getting the You've successfully authenticated message in this debug output, the SSH identity being generated by SourceTree itself, and ensuring my SSH Agent is running by doing eval "$(ssh-agent)".
I can also see the expected key in my github profile.
What is wrong here?
my SSH Agent is running by doing eval "$(ssh-agent)".
This is likely the problem. ssh knows to talk to ssh-agent via the SSH_AUTH_SOCK environment variables. Environment variables are only visible to a process and its children.
eval "$(ssh-agent)" sets SSH_AUTH_SOCK for this shell and its children only; that is anything you ran from that shell. If you then run git in this shell it should work. But if you have some stand alone program not launched from this shell, like Atlassian Sourcetree, when it runs ssh it will not know to talk to that ssh-agent.
You could launch Sourcetree from that shell, but that's not a very good solution.
To fix this, and a host of other ssh related problems, start your ssh-agent at login. This should be done for you by your operating system, or if not follow the instructions for your operating system. Otherwise, follow the advice in the various answers here.

github : push permission denied (

I know the question has been asked several times.
From my local machine I try to upload files to my repository:
:~/Git-JeanPat/pyFISH$ git push -u origin master
Agent admitted failure to sign using the key.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
my repository is
https://github.com/jeanpat/pyFISH
I check my password from the admin interface of github.
I made a new ssh key from command line, and I copy it on github.
When I check my connection as indicated. it fails:
~/Git-JeanPat/pyFISH$ ssh -vT git#github.com
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /home/simon/.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/simon/.ssh/id_rsa-cert type -1
debug1: identity file /home/simon/.ssh/id_dsa type -1
debug1: identity file /home/simon/.ssh/id_dsa-cert type -1
debug1: identity file /home/simon/.ssh/id_ecdsa type -1
debug1: identity file /home/simon/.ssh/id_ecdsa-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.9p1 Debian-5ubuntu1
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: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/simon/.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 RSA public key: /home/simon/.ssh/id_rsa
debug1: Remote: Forced command: gerve jeanpat 95:e1:bb:60:b5:31:63:39:3a:99:d1:01:22:87:3c:15
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
Agent admitted failure to sign using the key.
debug1: Trying private key: /home/simon/.ssh/id_dsa
debug1: Trying private key: /home/simon/.ssh/id_ecdsa
debug1: No more authentication methods to try.
Permission denied (publickey).
thanks for your help
I reboot my ubuntu 12.04 laptop and everything went fine ...

github ssh gives permission denied

I have been trying to access github via ssh/msysgit.
Also I have followed each instruction of how to configure the ssh client, instruction by instruction. Still I got permission denied.
I use Windows 7.
$ 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 /c/Users/Henrik/.ssh/identity type -1
debug1: identity file /c/Users/Henrik/.ssh/id_rsa type 1
debug1: identity file /c/Users/Henrik/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 D
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 /c/Users/Henrik/.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: /c/Users/Henrik/.ssh/identity
debug1: Offering public key: /c/Users/Henrik/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering public key: /c/Users/Henrik/.ssh/id_dsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
So your public and private keys are found, but the permission isn't granted.
That should be because you didn't correctly copied your public key to the GitHub Administration interface of your account, as explained in "Deploy SSH keys".