当前位置:首页 > CN2资讯 > 正文内容

github代理github代理加速

2天前CN2资讯

This tuturial will explain how to use git through a proxy, for example if you are behind a firewall or on a private network.

The examples are valid for connections inside the .cms network at Point 5, but it should be simple to adapt them to other configurations.

What kind of proxy

The most common are an HTTP proxy, and a SOCKS5 proxy - for example, one opened with the ssh -D command, documented in ssh(1).

How to open a SOCKS proxy through an SSH tunnel

The ssh command distributed with most Unix-like systems can open a SOCKS proxy on the local machine and forward all connections through the ssh tunnel.

For example

ssh -f -N -D 1080 cmsusr.cms

will connect to the host cmsusr.cms, open a SOCKS proxy on the local host on port 1080 (-D 1080), and put the process in background after a successful connection (-f -N).

How to connect to a git repository using the SSH protocol

If the remote has a format like

git@:cms-sw/cmssw.git ssh://git@/cms-sw/cmssw.git

then you are connecting to the git server using the SSH protocol.

In this case, git relis on ssh to handle the connection; in order to connect through a SOCKS proxy you have to configure ssh itself, setting the ProxyCommand option in your ~/.ssh/config file:

Host User git ProxyCommand nc -x localhost:1080 %h %p

OR On CentOS7 you can

Host User git ProxyCommand ssh cmsusr nc %h %p

For more information, see ssh_config(5).

How to connect to a git repository using the HTTP or HTTPS protocols

If the remote has a format like

http:///cms-sw/cmssw.git https:///cms-sw/cmssw.git

then you are connecting to the git server using the HTTP or HTTPS protocols. In the old days, this used to be a dumb protocol, but since git 1.6.6 it uses a smart protocol similar to that used by SSH or GIT.

In this case git uses libcurl to handle the connection; the version of git bundled with CMSSW supports different kinds of proxies: SOCKS4, SOCKS4a, SOCKS5, and HTTP/HTTPS. In order to connect through any proxy supported by libcurl, you can set the http.proxy option:

git config --global http.proxy socks5://localhost:1080

For more information, see the --proxy option in curl(1) and the http.proxy entry in git-config(1).

How to connect to a git repository using the GIT protocol

If the remote has a format like

git:///cms-sw/cmssw.git

then you are connecting to the git server using the GIT protocol.

In this case, it is possible to use a helper command to connect through any kind of proxy. A simple script is included with CMSSW, to connect through a SOCKS5 proxy: git-proxy. You can configure git to use it with

git config --global core.gitproxy "git-proxy" git config --global socks.proxy "localhost:1080"

For more information, see git-proxy --help.

link

    你可能想看:

    扫描二维码推送至手机访问。

    版权声明:本文由皇冠云发布,如需转载请注明出处。

    本文链接:https://www.idchg.com/info/24123.html

    标签: github代理
    分享给朋友:

    “github代理github代理加速” 的相关文章

    Linode悉尼数据中心:高性能云服务助力亚太业务增长

    Linode是一家成立于2003年的云服务提供商,专注于为开发者提供简化的基础设施服务。在全球范围内,Linode拥有多个数据中心,其中悉尼数据中心是其在亚太地区的重要节点。这个数据中心不仅为本地客户提供高效、稳定的云服务,还吸引了许多国际企业选择其作为亚太业务的支撑点。 数据中心位置与区域优势 L...

    为小学生选择合适的VPS:安全、易用和高性价比的评测指南

    在这个数字化时代,网络安全受到越来越多人的重视。小朋友们在网络上探索新知识、与朋友沟通时,面对的不仅是丰富的学习资源,还有潜在的网络风险。此时,VPS(虚拟个人服务器)作为一个安全、稳定的网络环境,开始逐渐进入小学生的视野。家长和学校意识到,提供一个良好的网络环境,不仅能保护孩子免受不良信息的侵害,...

    蘑菇云:自然与核爆炸的惊人现象及其深远影响

    蘑菇云这个词,一提起来让人既熟悉又敬畏。它的外形就像个倒立的蘑菇,顶部宽大、底部则较小,这是因为它源自于强大爆炸所产生的气体。这种云朵看似平常,却是一种强烈爆炸后气体与空气混合的结果。虽然蘑菇云在现代多被与核爆炸联系在一起,但实际上,火山喷发及一些天体撞击也可能产生自然形成的蘑菇云。 了解蘑菇云的形...

    VPS CN2:提升网络性能的最佳选择

    在了解VPS CN2之前,我觉得有必要先简单说说VPS究竟是什么。VPS即虚拟专用服务器,是一种利用虚拟化技术将物理服务器划分成多个独立的虚拟服务器。每个VPS都能独立运行操作系统和应用软件,用户可以通过远程方式管理和使用。这给了我们极大的灵活性和自由度,让我可以随时根据需求扩大或缩小资源。 说到V...

    台湾VPS:高效、稳定且安全的虚拟专用服务器解决方案

    台湾VPS,即虚拟专用服务器,是一种通过虚拟化技术将物理服务器划分为多个独立服务器的解决方案。这种服务不仅为用户提供独享的资源和灵活的管理权限,还能够提升性能和效率。在我使用台湾VPS的过程中,它让我深刻体会到这一技术的便利与强大。 台湾VPS的独特之处在于其地理位置和网络基础设施。位于东亚的台湾,...

    阿拉伯 VPS 购买指南:选择高效稳定的虚拟私人服务器

    在数字化时代,越来越多的人和企业需要高效、稳定的网络服务。此时,VPS(虚拟私人服务器)就成为了一个非常受欢迎的选项。VPS 是将物理服务器虚拟化后形成的多个独立虚拟服务器,每个 VPS 都拥有独立的操作系统和资源,这让它们很适合那些需要高度自定义和安全性的用户。 谈到阿拉伯 VPS,它们的特点尤为...