将其他仓库clone到本地
git clone https://{user}:{password}@{url}
如设置,插件会执行 git config user.name
如设置,插件会执行 git config user.email
将仓库 clone 到何处
仓库地址, 如 https://xxx.com/xxx/xxx.git,不支持 ssh 地址
登陆用的用户名,私有仓库必填
登陆用的密码,私有仓库必填
clone 深度,如 1,如设置,插件会在 git clone 后追加 --depth {depth}
clone 分支,如 main,如设置,插件会在 git clone 后追加 --single-branch --branch {branch}
main:
push:
- stages:
- name: git clone
image: tencentcom/git-clone
# 引用环境变量
imports: https://xxx.com/git-clone.yml
settings:
user_name: xxx
user_email: xxx
git_url: https://xxx/xxx/demo1.git
git_user: $GIT_USER
git_password: $GIT_PASSWORD
dist: other_repos
- name: git commit
script:
- cd other_repos/demo1
- echo 1 > tmp.txt
- git add .
- git commit -m "test"
- git push
在 云原生构建 可用 CNB_TOKEN_USER_NAME 和 CNB_TOKEN 作
为 git_user 和 git_password 去 clone 云原生构建 的仓库。
# .cnb.yml
main:
push:
- stages:
- name: git clone
image: tencentcom/git-clone
settings:
user_name: xxx
user_email: xxx
git_url: https://xxx/xxx/demo1
git_user: $CNB_TOKEN_USER_NAME
git_password: $CNB_TOKEN
dist: other_repos