{"id":43994110,"url":"https://github.com/leowzz/git_proxy","last_synced_at":"2026-02-07T11:20:53.680Z","repository":{"id":206820931,"uuid":"694955817","full_name":"leowzz/git_proxy","owner":"leowzz","description":"克隆项目前自动设置代理 并在克隆后取消设置代理","archived":false,"fork":false,"pushed_at":"2024-09-04T12:47:24.000Z","size":288,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-05T12:52:53.369Z","etag":null,"topics":["git","proxy"],"latest_commit_sha":null,"homepage":"","language":"Python","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/leowzz.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":"2023-09-22T03:32:54.000Z","updated_at":"2024-09-04T12:47:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"3125477d-0452-407d-b8de-47e3c4be9b07","html_url":"https://github.com/leowzz/git_proxy","commit_stats":null,"previous_names":["3181538941/git_proxy","leowzz/git_proxy"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/leowzz/git_proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leowzz%2Fgit_proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leowzz%2Fgit_proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leowzz%2Fgit_proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leowzz%2Fgit_proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leowzz","download_url":"https://codeload.github.com/leowzz/git_proxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leowzz%2Fgit_proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29193260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["git","proxy"],"created_at":"2026-02-07T11:20:52.140Z","updated_at":"2026-02-07T11:20:53.665Z","avatar_url":"https://github.com/leowzz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git使用本地代理来克隆项目\n\n## 背景\n\n一般我们会遇到github上的项目克隆不下来的问题\n\n有个操作就是配置一下git的代理, 但配置完有时又会影响到一些普通的git操作\n\n所以这个工具的作用就是: 设置代理 -\u003e 执行命令 -\u003e 取消代理\n\n当然 也附带了一键配置代理(-s), 一键取消配置(-u)以及获取配置状态(-g)等功能\n\n## 其他方式\n\n经 [即刻 qaqland](https://web.okjike.com/u/d4139d2b-e61e-4bdf-a69c-1a671d5d1c2b) 提醒, 可以针对不同的域名配置代理,\n这样就可以避免影响其他git操作了,\n\nref: [git-config-proxy](https://git-scm.com/docs/git-config/2.22.0#EXAMPLES), [Git-set-proxy-for-a-domain](https://morethink.cn/%E5%B7%A5%E5%85%B7/Git-set-proxy-for-a-domain/)\n\n可以通过修改 `~/.gitconfig` 实现\n\n```ini\n[http \"https://github.com/\"]\nproxy = http://127.0.0.1:7898\n[https \"https://github.com/\"]\nproxy = http://127.0.0.1:7898\n[http \"https://my.gitserver.com/\"]\nproxy = \"\"\n```\n\n更推荐使用这种方式\n\n## 1. 使用\n\n推荐为程序配置环境变量, 这样就可以在任意目录下使用了✔\n工具的配置文件在 `~/.gitc/gitc.ini` 可以手动更改 host, port\n\n```shell\n\n在你的工作目录执行\n\n   ```shell\n   gitc clone https://github.com/3181538941/git_proxy.git\n   ```\n\n执行效果\n![img.png](img/img.png)\n\n更多方式\n\n```shell\ngitc -h\n```\n\n## 2. 开发\n\n安装依赖\n\n```shell\npip install -r requirements.txt\n```\n\n构建\n\n[build.md](./build.md)\n\n## 3. fuck😒\n\n代码推送过程中遇到了比较常见的问题\n\u003e fatal: unable to access 'https://github.com/3181538941/git_proxy.git/': OpenSSL SSL_read: Connection was reset, errno\n\u003e 10054\n\n这种情况下就需要设置代理, 我意识到 需要脚本来实现设置代理和取消设置代理\n\n所以添加了两个脚本 `-s`, `-u`\n\n可以快捷地设置和取消设置git proxy\n\n## 4. 原理\n\n1. 执行代理设置命令\n\n    ```shell\n    git config --global http.proxy http://127.0.0.1:7890\n    git config --global https.proxy http://127.0.0.1:7890\n    ```\n\n2. 执行克隆命令\n\n    ```shell\n    git clone https://github.com/3181538941/git_proxy.git\n    ```\n\n3. 取消设置代理 避免影响git正常使用\n\n    ```shell\n    git config --global --unset http.proxy\n    git config --global --unset https.proxy\n    ```\n\n# 5. Todo\n\n- [ ] 支持查看配置 gitc config ls\n- [ ] 支持快速修改配置 gitc config set\n- [x] 支持直接代理git模式\n- [ ] 支持代理配置切换\n- [ ] 增加更多的代理\n- [ ] 增加更多的命令\n- [ ] 增加更多的测试\n- [ ] 增加更多的文档\n- [ ] 增加更多的注释\n- [ ] 增加更多的日志\n- [ ] 增加更多的错误处理\n- [ ] 增加更多的异常处理\n- [ ] 增加更多的功能\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleowzz%2Fgit_proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleowzz%2Fgit_proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleowzz%2Fgit_proxy/lists"}