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

2024-04-20 10:27:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我在让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上运行时,我如何才能克服这个问题?你知道吗


Tags: thegitciosrepository方式gitlabcd
1条回答
网友
1楼 · 发布于 2024-04-20 10:27:15

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

你也可以试试ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null git@gitlab.comssh git@gitlab.com。你会发现不同的。你知道吗

您需要删除此指纹或禁用密钥检查

相关问题 更多 >