乐趣区

关于git:本地pull-push-2个github账号的仓库

记录下本地 git clone, git push 2 个 github 账号的 repository, git push 到另一个 github 账号的 repository 报错 (fatal: unable to access ‘https://github.com/raojiahong…’: Failed to connect to github.com port 443: Timed out) 的解决办法。

git 操作步骤:

  1. 提前生成了 jiahong888 账号的 publickey, 执行如下代码 clone iris-demo, 我的项目, 账号, 邮箱需替换成本人的:

    git clone git@github.com:jiahong888/iris-demo.git
    git config --global user.name 'jiahong888'
    git config --global user.email 'jiahong888@qq.com'
  2. 批改 iris-demo 我的项目的代码,可失常提交:

    git commit -m 'comment'
    git push
  3. clone raojiahong888 账号下的我的项目:

    git clone https://github.com/raojiahong888/go-zero-demo.git
  4. 批改 go-zero-demo 我的项目的代码,commit 而后 push:

    git commit -m 'comment'
    git push

    当 remote 地址是 https 时,push 报错: fatal: unable to access ‘https://github.com/raojiahong…’: Failed to connect to github.com port 443: Timed out.
    当 remote 地址是 git@github.com 时,push 报错:ERROR: Permission to raojiahong888/go-zero-demo.git denied to jiahong888.
    fatal: Could not read from remote repository.
    (为防止抵触,jiahong888 账号下我的项目的仓库地址应用 git@github.com 时,raojiahong888 账号下我的项目的仓库地址应用 https。)

  5. 通过勾销全局代理, 解决 (Failed to connect to github.com port 443: Timed out) 问题:

    git config --global --unset http.proxy
    git config --global --unset https.proxy
退出移动版