【问题标题】:SSH and Git CloneSSH 和 Git 克隆
【发布时间】:2023-03-27 07:05:01
【问题描述】:

是否可以通过 ssh 连接到远程服务器并触发 git clone。即我需要 ssh 到服务器 A,创建一个文件夹 /tmp/A 并在 A 上克隆一个包含其所有内容的存储库。远程服务器的 ssh 密钥配置为连接到 git。

ssh root@Server 
git init
git clone gitproject.

这不起作用。任何帮助表示赞赏。我觉得脚本步骤是异步运行的,因此克隆失败,找不到 .git。

【问题讨论】:

  • This doesn't work 到底是什么意思?任何错误信息? gitproject 后面的点 . 是故意的吗?
  • 也许只是ssh root@Server 'git clone Your-URL /tmp/A' ?
  • 尝试用这种方式解决你的问题。reference URL

标签: git ssh git-branch


【解决方案1】:

你说:"I feel the script steps are run asynchronously", 这表明您在脚本中执行所有这些操作,因此您的 git initgit clone 是在本地完成的。你实际上不需要git init

在服务器上远程克隆仓库

ssh root@server 'git clone gitproject /tmp/A'

在服务器上发出命令并将其克隆到那里。

【讨论】:

    猜你喜欢
    • 2020-03-20
    • 1970-01-01
    • 2013-08-07
    • 1970-01-01
    • 2017-08-07
    • 1970-01-01
    • 1970-01-01
    • 2015-07-11
    相关资源
    最近更新 更多