相干命令

  1. git remote

     git remote add origin xxx (xxx为仓库链接)

    给这个链接取一个名字,为origin

  2. git pull

    git pull <近程主机名>  <近程分支名>:<本地分出名>
  3. git push

    git push origin main
  4. 删除一个近程仓库

    git remote rm xxx(仓库名)
  5. 批改一个近程仓库链接

    git remote set-url origin <remote-url>
  6. 查问仓库

    git remote -v

常见谬误

  1. 把本地的master分支重命名为main

    git branch -m master main
  2. 当Failed to connect to 127.0.0.1 port 1080

    // 首先,查一下以后全局的 http 代理:git config --global http.proxy// 如果有代理,就勾销git config --global --unset http.proxy// 再查 https 的代理:git config --global https.proxy// 同样的,有就勾销git config --global --unset https.proxy
  3. 当'credential-manager' is not a git command

    git config --global credential.helper wincred
  4. 当OpenSSL SSL_read: Connection was reset

    git config --global http.sslVerify "false"
  5. 当fatal: refusing to merge unrelated histories

    问题剖析:呈现这个问题的最次要起因还是在于本地仓库和近程仓库实际上是独立的两个仓库。如果我之前是间接clone的形式在本地建设起近程github仓库的克隆本地仓库就不会有这问题了。

     git pull origin main --allow-unrelated-histories