2015-10-16 229 views
2

我想使用GIT Bash上傳服務器上的文件。我爲Windows使用msysgit。Windows上的Git bash - 不支持sftp

FTP上傳正常,但sftp無法正常工作。

git ftp init --verbose

給我的錯誤:SFTP,不支持或libcurl中

我嘗試安裝libssh2 Cygwin的這一參考http://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm#EMBSC150

但錯誤依然ocured禁用。我不知道我是否必須直接向GIT Bash安裝某些東西,或者我還能做些什麼?

謝謝你的任何建議。


編輯:我更新了msysgit和其他軟件,現在我只是不知道如何從服務器獲取證書。從WinSCP我只使用接受指紋,就是這樣。

curl -v --insecure sftp://user:[email protected]

  • 提供SSH認證方法:公鑰,密碼
  • 使用SSH公共密鑰文件 '(無)'
  • 使用SSH私鑰文件「C:\用戶\ XXX /的.ssh/id_rsa」
  • SSH公鑰驗證失敗:用戶名/公鑰組合無效

捲曲:(67)AUTHENT失敗

我在這裏看到https://github.com/git-ftp/git-ftp/issues/124,我可以使用另一個鍵,而不是我的默認值。但我不知道如何從服務器獲取密鑰。

回答

3

確保您沒有使用Cygwin或old and obsolete msysgit 1.9.x version的git。

隨着new git for windows,sftp應予以支持:

C:\Users\vonc\prog\seec>c:\prgs\git\PortableGit-2.6.1-64-bit\usr\bin\curl.exe -V 
curl 7.44.0 (x86_64-pc-msys) libcurl/7.44.0 OpenSSL/1.0.2d zlib/1.2.8 libidn/1.32 libssh2/1.6.0 
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: Debug IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets Metalink 

This project which needs sftp requires only user and password without any certificate file

真,沒有必要爲ssl certificate with sftp,只是讓沒有鑰匙在 'C:\Users\xxx/.ssh/id_rsa(.pub)'

From WinSCP I use only accept fingerprint and that was it.

這可能是問題:known_host必須具有遠程服務器指紋。見for instance my script或這篇博客:

To get a look at the server’s public key fingerprint before attempting a connection, one can utilize the ssh-keyscan program

ssh-keyscan -t ecdsa host.example.org > tmp 
ssh-keygen -lf tmp 
256 03:ed:6d:1f:ff:56:9d:5f:f3:65:20:b5:ad:55:55:87 host.example.org (ECDSA) 

Here the -t is for type of key to be scanned (which can be rsa1 for protocol version 1, dsa, ecdsa, ed25519, or rsa for protocol version 2).
The output is redirected to a temporary file named tmp , then the file is checked with the ssh-keygen program.

Once client has verified the fingerprint, it will store a copy of the server’s public key in $HOME/.ssh/known_hosts and will check the stored key on subsequent connections to that host.
If the server has changed its keys, or another machine is attempting to spoof the real server, the client will notice and will not allow connections to that host.

+1

@ManicDepression有點像https://github.com/git-ftp/git-ftp/issues/208,我想?檢查'curl -v --insecure sftp://ftp.xxx.com:22/var/www/xxx.com'返回。另請參閱http://stackoverflow.com/a/31750959/6309 – VonC

+0

您可以使用curl -v命令的輸出編輯您的問題嗎?以防萬一我看到了什麼?檢查是否定義了環境變量HOME。 – VonC

+0

@ManicDepression似乎很清楚:試着從'C:\ Users \ xxx \ .ssh'移開(不刪除,只是移動)'id_rsa(.pub)'ssh密鑰文件,看看'user:password'作品。 – VonC