繁体   English   中英

如何获得GitLab CI / CD作业以推送到外部存储库?

[英]How can I get GitLab CI/CD jobs to push to external repositories?

我在让Gitlab CI / CD将新的更改推送到当前存储库时遇到了问题。 显然,到目前为止还无法完成。 所以现在,我正在尝试查看它是否可以推送到其他存储库。

这就是我想要做的:

  • 将另一个仓库克隆到我的仓库中
    • 我们称我的路由器为
    • 让我们打电话给另一个Rinner
  • 以某种方式修改Rinner
  • 提交并仅将更改推送到Rinner
  • 然后从路由器中删除Rinner

我正在尝试在Python中进行测试,目前有:

    os.system('mkdir temp');
    os.chdir('temp');
    os.system('git clone git@gitlab.com/path/Rinner.git');
    os.chdir('Rinner');
    os.system('echo "Hello World!" > hello.txt');
    os.system('git add -A');
    os.system('git commit -m "Running a test..."');
    os.system('git push --force');
    os.chdir('..');
    os.chdir('..');
    os.system('rm -rf temp');

在我的本地计算机上,它可以完美运行。

在我的GitLab CI / CD工作中,得到以下结果。

Cloning into 'Rinner'...
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

当它在GitLab CI / CD上运行时,如何解决这个问题?

您正在通过SSH克隆git clone git@gitlab.com/path/Rinner.git ,问题是您在〜/ .ssh / known_hosts中的运行程序上存储了错误的服务器指纹

您也可以尝试ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null git@gitlab.comssh git@gitlab.com 您会有所不同。

您需要删除此指纹或禁用StrictHostKeyChecking

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM