{"id":20139223,"url":"https://github.com/lpreterite/drone-plugin-git-sync","last_synced_at":"2025-11-01T03:04:46.490Z","repository":{"id":42118878,"uuid":"162240816","full_name":"lpreterite/drone-plugin-git-sync","owner":"lpreterite","description":"同步代码至另一个项目的`drone`插件","archived":false,"fork":false,"pushed_at":"2024-05-31T06:14:30.000Z","size":156,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-13T10:11:28.622Z","etag":null,"topics":["drone-plugin","git"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lpreterite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-18T06:25:38.000Z","updated_at":"2024-05-31T06:14:33.000Z","dependencies_parsed_at":"2024-11-13T21:44:39.535Z","dependency_job_id":"6dfd881b-7400-43d7-ad99-18d32e4ab332","html_url":"https://github.com/lpreterite/drone-plugin-git-sync","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpreterite%2Fdrone-plugin-git-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpreterite%2Fdrone-plugin-git-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpreterite%2Fdrone-plugin-git-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpreterite%2Fdrone-plugin-git-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lpreterite","download_url":"https://codeload.github.com/lpreterite/drone-plugin-git-sync/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241582557,"owners_count":19985846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drone-plugin","git"],"created_at":"2024-11-13T21:44:29.757Z","updated_at":"2025-11-01T03:04:46.462Z","avatar_url":"https://github.com/lpreterite.png","language":"JavaScript","readme":"# drone-plugin-git-sync\n\n[![Docker Automated build](https://img.shields.io/docker/automated/lpreterite/drone-plugin-git-sync)](https://hub.docker.com/r/lpreterite/drone-plugin-git-sync)\n\n同步代码至另一个项目的`drone`插件，主要操作：拉取指定仓库后拷贝代码至相应目录并提交推送。\n\n## Usage\n\nExecute from the working directory:\n\n```sh\nMSYS_NO_PATHCONV=1 docker run --rm \\\n    -e PLUGIN_GIT_USERNAME=\"packy-tang\" \\\n    -e PLUGIN_GIT_PASSWORD=\"******\" \\\n    -e PLUGIN_GIT_CONFIG='{\"name\": \"packy-tang\", \"email\": \"xxx@xxx.com\"}' \\\n    -e PLUGIN_REPOSITORY='{\"url\":\"https://github.com/lpreterite/drone-plugin-git-sync.git\", \"branch\":\"master\"}' \\\n    -e PLUGIN_COPY=dist:public2,dist/index.html:resources/views/index.php \\\n    -v $(pwd):$(pwd) \\\n    -w $(pwd) \\\n  lpreterite/drone-plugin-git-sync\n```\n\nThe setting in drone plugin:\n\n```yml\nkind: pipeline\nname: default\n\nsetps:\n    - name: git-sync\n      image: lpreterite/drone-plugin-git-sync\n      settings:\n          overwrite: \"true\"\n          copy:\n              - \"dist:public\"\n          repository:\n              url: https://github.com/lpreterite/vue-tinymce.git\n              branch: master\n          git_config:\n              name: \"Packy-tang\"\n              email: \"lpreterite@126.com\"\n          git_username:\n              from_secret: username\n          git_password:\n              from_secret: password\n```\n\nUse ssh and set ssh_key:\n\n```yml\nkind: pipeline\nname: default\n\nsetps:\n    - name: git-sync\n      image: lpreterite/drone-plugin-git-sync\n      settings:\n          overwrite: \"true\"\n          copy:\n              - \"dist:public\"\n          repository:\n              url: ssh://github.com/lpreterite/vue-tinymce.git\n              branch: master\n          git_config:\n              name: \"Packy-tang\"\n              email: \"lpreterite@126.com\"\n          git_ssh_key: \n              from_secret: ssh_key\n```\n\nUse ssh:\n\n```yml\nkind: pipeline\nname: default\n\nsetps:\n    - name: git-sync\n      image: lpreterite/drone-plugin-git-sync\n      volumes:\n          - name: sshkeys\n            path: /ssh/keys/\n      settings:\n          overwrite: \"true\"\n          copy:\n              - \"dist:public\"\n          repository:\n              url: ssh://github.com/lpreterite/vue-tinymce.git\n              branch: master\n          git_config:\n              name: \"Packy-tang\"\n              email: \"lpreterite@126.com\"\n          git_ssh: /ssh/keys/id_rsa\n\nvolumes:\n    - name: sshkeys\n      host:\n          path: /ssh/keys/\n```\n\n## Options\n\n| env                    | yml               |                                                                                                                  |\n| ---------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------- |\n| PLUGIN_DEBUG | debug   | `boolean` ，默认为`false` ，开启后能打印调试用信息。                        |\n| PLUGIN_CWD             | cwd               | `string`, 仓库下载处理目录，默认为`./tmp/`                                                                       |\n| PLUGIN_OVERWRITE       | overwrite         | `boolean`, 拷贝文件时是否复写文件，默认为\"true\"                                                                   |\n| PLUGIN_REPOSITORY      | repository        | `json`, 仓库信息，默认为`{\"url\":\"[Repository Url]\", \"branch\":\"master\", \"commit_label\": \"update by drone\"}`       |\n| PLUGIN_COPY            | copy              | `array`, 拷贝文件的设置，设置方式为：\"[source path]:[target path]\"                                               |\n| PLUGIN_GIT_CONFIG      | git_config        | `json`, git 设置，目前只支持设置`name`和`email`，接受格式：`{ name: '[yourname]', email:'[yourname@mail.com]' }` |\n| PLUGIN_GIT_USERNAME    | git_auth_username | `string`, 仓库授权的账户，用于 http 方式 push 仓库时使用                                                         |\n| PLUGIN_GIT_PASSWORD    | git_auth_password | `string`, 仓库授权的密码，用于 http 方式 push 仓库时使用                                                         |\n| PLUGIN_GIT_SSH         | git_ssh           | `string`, 仓库授权私钥地址，用于 ssh 方式 push 仓库时使用                                                        |\n| PLUGIN_GIT_SSH_KEY     | git_ssh_key       | `string`, 仓库授权私址，用于 ssh 方式 push 仓库时使用。                                                          |\n| PLUGIN_GIT_CLONE_DEPTH | git_clone_depth   | `number`,默认值为`1`, 拉取仓库时保留历史数目，默认设置1，用于加快仓库拉取。                                      |\n\n## Build\n\n```sh\ndocker build -t lpreterite/drone-plugin-git-sync .\n```\n\n\u003e `from_secret`作用的参数需要在 drone 版面下找到`SETTINGS-\u003eSecrets`进行添加\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpreterite%2Fdrone-plugin-git-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flpreterite%2Fdrone-plugin-git-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpreterite%2Fdrone-plugin-git-sync/lists"}