国内 git push 到 github 的配置

文章目录

    网络异常

    国内通过 git push 到 github 时,会报错:

    > git push github --all
    fatal: unable to access 'https://github.com/xxx/yyy.git/': Failed to connect to github.com port 443 after 21164 ms: Timed out
    

    虽然能在浏览器里访问 github,但是命令行里却会网络超时。

    git 全局配置

    git config –global http.https://github.com.proxy socks5://127.0.0.1:4455
    

    这样配置,有个好处,就是只对 github.com 采用这个配置,对于其他 git 仓库不会有影响。

    Windows 的 git 配置在哪里

    > cat C:\Users\zhong\.gitconfig
    [user]
            name = Zhongwei Sun
            email = xxx@gmail.com
    [credential]
            helper = manager
    [http "https://github.com"]
            proxy = socks5://127.0.0.1:4455
    

    没想到 powershell 下也能使用 cat 和 ~/.