我在 ANT 的帮助下进行 GIT 克隆。我正在使用下面的代码:
<target name ="deploy">
<sshexec host="ssh://user@rep_location/project_name.git"
username="username"
password=""
passphrase="passphrase"
trust="true"
command="git clone ssh://user@rep_location/project_name.git D:/dest"/
/>
</target>
位置“D:/dest
”是我希望克隆存储库的所需文件夹。但它会以 unknown host exception
的形式抛出错误。
我尝试了一些与主机的组合,例如 ssh://user@rep_location
但它也返回服务器连接超时。
我们要求在 checkout 时提供密码。
此命令适用于 GIT BASH
。
最佳答案
这应该与这个“未知主机 key ”经典 ssh 错误有关:请参阅“com.jcraft.jsch.JSchException: UnknownHostKey”。
最简单的解决方案仍然是首先手动执行 ssh:
Try to ssh from the command line and accept the public key (the host will be added to
~/.ssh/known_hosts
)
确保在 Windows 上定义了 HOME
环境变量,其中 JSch used by the sshexec ant task将能够找到 %HOME%\.ssh\known_hosts
文件。
这与类 unix 的 git bash session 不同,后者始终定义 $HOME。
https://stackoverflow.com/questions/17672924/
相关文章:
sql-server - SQL Server 2008 的 FreeTextTable 性能不佳
spring - 如何为持久性 Quartz 作业重命名作业类?
ruby-on-rails - 如何在到达 Rails 应用程序之前处理从 Rack 生成的异常
scikit-learn - 在传递到 'roc_curve' 之前如何处理从 'auc' 返回的
authentication - PuTTy 连接但 key 在使用 Plink 时被拒绝
ruby-on-rails - 在超时注销之前向用户显示一条消息