在你项目中创建分支后,你在分支上push代码到远程仓库时你可能会遇到如下的问题:
E:\Javaexample\Zorio>git push
fatal: The current branch dev2 has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin dev2
dev2分支没有和远程仓库关联
此时你输入git push --set-upstream origin dev2 关联时,会报以下错误(以demo项目为例):
E:\Javaexample\Zorio>git push --set-upstream origin dev2
fatal: unable to access 'https://github.com/ZorioneShi/Zorio.git/': Failed to connect to github.com port 443: Timed out
此时是由于你本地代理服务器没有修改,以win10为例,打开网络共享中心,左下角的Internet选项,打开连接选项局域网设置,勾掉代理服务器,选择自动检测设置,保存退出再回到代码。
输入git push --set-upstream origin dev2命令绑定远程分支,最好本地和远程分支名一样,不易忘记,此时如下代码,则关联远程分支成功
E:\Javaexample\Zorio>git push --set-upstream origin dev2
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 358 bytes | 358.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
remote:
remote: GitHub found 5 vulnerabilities on ZorioneShi/Zorio's default branch (5 low). To find out more, visit:
remote: https://github.com/ZorioneShi/Zorio/security/dependabot
remote:
To https://github.com/ZorioneShi/Zorio.git
7676aaf..42eea7e dev2 -> dev2
Branch 'dev2' set up to track remote branch 'dev2' from 'origin'.
此时若你要提交修改的代码,如若安全http.sslVerify安全设置没有修改,会出以下错误:
E:\Javaexample\Zorio>git push
fatal: unable to access 'https://github.com/ZorioneShi/Zorio.git/': OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
此时需要你设置一下参数:
E:\Javaexample\Zorio>git config http.sslVerify "false"
然后再执行push命令则可提交到远程分支
E:\Javaexample\Zorio>git push
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 349 bytes | 349.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
remote:
remote: GitHub found 5 vulnerabilities on ZorioneShi/Zorio's default branch (5 low). To find out more, visit:
remote: https://github.com/ZorioneShi/Zorio/security/dependabot
remote:
To https://github.com/ZorioneShi/Zorio.git
42eea7e..80335a9 dev2 -> dev2