ATM git-annex passes sftp:// urls to be handled with curl.
But that one does not (re)use established ssh control sockets and/or credentials

E.g.

[[!format sh """
$> git annex addurl --debug sftp://localhost/tmp/123  
[2018-01-12 09:53:35.195801836] read: git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","show-ref","git-annex"]
[2018-01-12 09:53:35.199709648] process done ExitSuccess
[2018-01-12 09:53:35.199781091] read: git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","show-ref","--hash","refs/heads/git-annex"]
[2018-01-12 09:53:35.203370157] process done ExitSuccess
[2018-01-12 09:53:35.204373706] chat: git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","cat-file","--batch"]
[2018-01-12 09:53:35.204819259] chat: git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","cat-file","--batch-check=%(objectname) %(objecttype) %(objectsize)"]
addurl sftp://localhost/tmp/123 [2018-01-12 09:53:35.208782745] read: curl ["-s","--head","-L","sftp://localhost/tmp/123","-w","%{http_code}","--user-agent","git-annex/6.20171211+gitgba511f4de-1~ndall+1"]
[2018-01-12 09:53:35.290168768] process done ExitFailure 51

[2018-01-12 09:53:35.290835362] call: wget ["-nv","--show-progress","--clobber","-c","-O","/tmp/bu/.git/annex/tmp/URL--sftp&c%%localhost%tmp%123","sftp://localhost/tmp/123","--user-agent","git-annex/6.20171211+gitgba511f4de-1~ndall+1"]
sftp://localhost/tmp/123: Unsupported scheme ‘sftp’.
[2018-01-12 09:53:35.299065531] process done ExitFailure 1
failed
[2018-01-12 09:53:35.299781408] process done ExitSuccess
[2018-01-12 09:53:35.299993431] process done ExitSuccess
git-annex: addurl: 1 failed


"""]]

So far we haven't managed to make curl behave sanely with sftp urls without us passing explicitly the login name and then a password and then it still failed:

[[!format sh """
$> curl sftp://localhost/tmp/123 -u yoh            
Enter host password for user 'yoh':
curl: (51) SSL peer certificate or SSH remote key was not OK
"""]]

I wondered if it would be feasible for git annex natively support ssh (scp) and/or sftp urls?  All the machinery is there since it deals with copying files over ssh already.

[[!meta author=yoh]]
[[!tag projects/datalad]]
[[!tag unlikely moreinfo]]
