- 上传流程
git init //初始化仓库
git add . //添加文件到本地仓库
git branch -M main //选择main分支,可以改名上传其它分支
git commit -m "first commit" //添加文件描述信息
git remote add origin https://github.com/xxx/xxxx.git //链接远程仓库,创建主分支
git pull origin main // 把本地仓库的变化连接到远程仓库主分支
git push -u origin main //此处上传的是main分支
- main主分支问题
关于main主分支问题,主要在于git push -u origin main
这句,由于大部分教程用的master分支作为样例,所以导致我们大家可能理解有所偏差,这里改为main即可。
- 推送更新出现错误: hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: ‘git pull …’) before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push --help’ for details.
git push -f origin main //强制push就成功了。
但大家不要随便用-f的操作,因为f意味着强制push,会覆盖掉远程的所有代码。
- error: remote origin already exists.
git remote rm origin //先删除远程 Git 仓库
git remote add origin xxx //再添加远程 Git 仓库
- OpenSSL SSL_read: Connection was reset, errno 10054
git config --global http.sslVerify "false"
- Failed to connect to github.com port 443: Timed out
git config --global --unset http.proxy
若发现其余错误,陆续更新,也欢迎大家私信联系我或评论。loading..