常见的git命令和git->github错误
相关命令
-
git remote
git remote add origin xxx (xxx为仓库链接)给这个链接取一个名字,为origin
-
git pull
git pull <远程主机名> <远程分支名>:<本地分知名> -
git push
git push origin main -
删除一个远程仓库
git remote rm xxx(仓库名) -
修改一个远程仓库链接
git remote set-url origin <remote-url> -
查询仓库
git remote -v
常见错误
-
把本地的master分支重命名为main
git branch -m master main -
当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 -
当'credential-manager' is not a git command
git config --global credential.helper wincred -
当OpenSSL SSL_read: Connection was reset
git config --global http.sslVerify "false" -
当fatal: refusing to merge unrelated histories
问题分析:出现这个问题的最主要原因还是在于本地仓库和远程仓库实际上是独立的两个仓库。假如我之前是直接clone的方式在本地建立起远程github仓库的克隆本地仓库就不会有这问题了。
git pull origin main --allow-unrelated-histories

浙公网安备 33010602011771号