Git LFS push not working when using SSH authentication?

Following is the link to setup SSH configuration for working with Git lfs repositories in Artifactory. Please note that “passphrase” is not to be provided when you are creating SSH keys for server authentication. If the “passphrase” is provided when you generate the SSH keys for server authentication, then you will see an error like the below example when attempting the git lfs push to Artifactory. 

(0 of 1 files) 0 B / 4.09 MB 
Post https://localhost/artifactory/gitlfs-local/objects/batch: dial tcp [::1]:443: getsockopt: connection refused

In the artifactory.log you will notice the below exception for the failed attempt:

2016-01-18 18:49:12,089 [sshd-SshServer[f4220a5]-nio2-thread-2] [WARN ](o.a.s.s.s.ServerSession:456) – Exception caught
org.apache.sshd.common.SshException: sendKexInit() none of the keys appears in supported list: [ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, ssh-dss, ssh-rsa]

The other reason for the failure to push to Artifactory when using SSH authentication is if you have provided an incorrect SSH port to be connected to Artifactory in the “.git/config” file which is under the local git repository. The url in this file should have the SSH port that is configured in Artifactory during the SSH server configuration. Below is a sample “.git/config” file with the Artifactory URL highlighted:

[core]

             repositoryformatversion = 0

             filemode = true

             bare = false

             logallrefupdates = true

             ignorecase = true

             precomposeunicode = true

[remote “origin”]

             url = https://github.com/nihalreddy28/project-examples.git

             fetch = +refs/heads/*:refs/remotes/origin/*

[branch “master”]

             remote = origin

             merge = refs/heads/master

[lfs]

             url = “ssh://git@localhost:1339/artifactory/gitlfs-local”

As a troubleshooting step, you can also run the below command to see if the SSH authentication with Git lfs is working. Remember to change the IP, port and the git lfs repository name to reflect the customer environment. The option for download “0abcd” can be given anything as this is only for a test and nothing is actually downloaded.

Mymac-MBP:project-examples mac$ ssh <ServerName> -p <port> git-lfs-authenticate artifactory/<reponame> download 0abcd


The command should look like the below example:

ssh 127.0.0.1 -p 1339 git-lfs-authenticate artifactory/gitlfs-local download 0abcd

If the SSH auth is successful, you should see the below output.

{“header”:{“Authorization”:”Bearer UPehbrgQaBKtm2E/Aj570vIWKk7n6cujPRB6mcuFPpU=”},”href”:”http://localhost:8081/artifactory/api/lfs/gitlfs-local”}