网站销售公司,国内比较大的源码网站,wordpress 钩子列表,it培训机构哪个好Github Actions是Github推出的自动化CI/CD的功能#xff0c;我们将使用Github Actions让Github仓库同步到Gitee 同步的原理是利用 SSH 公私钥配对的方式拉取 Github 仓库的代码并推送到 Gitee 仓库中#xff0c;所以我们需要以下几个步骤
生成 SSH 公私钥添加公钥添加私钥配…Github Actions是Github推出的自动化CI/CD的功能我们将使用Github Actions让Github仓库同步到Gitee 同步的原理是利用 SSH 公私钥配对的方式拉取 Github 仓库的代码并推送到 Gitee 仓库中所以我们需要以下几个步骤
生成 SSH 公私钥添加公钥添加私钥配置代码
1、生成SSH公钥
执行命令ssh-keygen -t rsa -C youremailexample.com连续三次回车id_rsa 为私钥id_rsa.pub为公钥 如果提示already exists已经存在则可以到电脑位置C:\Users\电脑账号名\ .ssh 直接使用 不使用默认SSH参考生成/添加SSH公钥
2、GitHub项目配置SSH私钥
在Github项目 Settings-Secrets-Actions名称为GITEE_RSA_PRIVATE_KEY值为上面生成SSH的 私钥,私钥是 id_rsa 文件
3、GitHub配置SSH公钥
在Github Settings-SSH and GPG keys-New SSH key名称为GITEE_RSA_PUBLIC_KEY值为上面生成SSH的 公钥
4、Gitee配置SSH公钥
在Gitee 设置-安全设置-SSH公钥标题为GITEE_RSA_PUBLIC_KEY值为上面生成SSH的 公钥
5、GitHub创建Github workflow
在Github项目 Actions创建一个新的workflow
name: Sync To Giteeon: [ push, delete, create ]jobs:build:runs-on: ubuntu-lateststeps:- name: Sync to Giteeuses: wearerequired/git-mirror-actionmasterenv:# 注意在 Settings-Secrets 配置 GITEE_RSA_PRIVATE_KEYSSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}with:# 注意替换为你的 GitHub 源仓库地址source-repo: gitgithub.com:github-username/github-repositoryname.git# 注意替换为你的 Gitee 目标仓库地址destination-repo: gitgitee.com:gitee-username/gitee-repositoryname.git成功运行