之前已经用Gitbook Editor中去同步和上传代码到远程:
了。
更新代码后,然后去terminal中
git commit
之后再去:
git push
出错:
➜ http_restful_api git:(master) git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push –set-upstream origin master
然后去试了试:
git push –set-upstream origin master
但是半天都无法上传,死掉了:
➜ http_restful_api git:(master) git push –set-upstream origin master
Counting objects: 50, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (49/49), done.
^Citing objects: 42% (21/50)
去Gitbook Editor中sync也是类似现象:
始终无法上传
-》而此处的代码其实很少,应该几秒种就上传同步成功才对。
gitbook git push fatal: The current branch master has no upstream branch
git push fatal: The current branch master has no upstream branch
试试:
git push -u origin master
好像和:
git push –set-upstream origin master
是一样的,还是停滞不前:
去试试:
➜ http_restful_api git:(master) git remote add originhttps://github.com/crifan/http_restful_api
fatal: remote origin already exists.
再去:
➜ http_restful_api git:(master) git pull –rebasehttps://github.com/crifan/http_restful_api
* branch HEAD -> FETCH_HEAD
Current branch master is up to date.
➜ http_restful_api git:(master) git status
On branch master
nothing to commit, working tree clean
➜ http_restful_api git:(master) git push origin master
Counting objects: 50, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (49/49), done.
Writing objects: 42% (21/50)
问题依旧。
算了,删除git仓库,重新创建吧。
git push origin master hang on
试了:
➜ http_restful_api git:(master) git config –global core.askpass “git-gui–askpass”
结果问题依旧。
➜ http_restful_api git:(master) git remote -v
git push origin master dead
那就继续去试试:
➜ http_restful_api git:(master) git push origin master
Counting objects: 50, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (49/49), done.
Writing objects: 42% (21/50)
等待个几个小时,看看结果如何。
是否会超时而报错。
结果后来竟然成功上传了:
➜ http_restful_api git:(master) git push origin master
Counting objects: 50, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (49/49), done.
Writing objects: 100% (50/50), 1.44 MiB | 2.00 KiB/s, done.
Total 50 (delta 12), reused 0 (delta 0)
remote: Resolving deltas: 100% (12/12), completed with 6 local objects.
4d65b1d..7ee92bf master -> master
【总结】
此处,不知道是网络还是其他原因,本身通过:
git push origin master
应该很快上传代码的,结果却中途死掉的感觉。
最后是等待足够长时间(具体不知道多长时间,反正是2多个小时候后)是成功上传了的。
【后记】
后来,去commit后的push就很正常了,且用的是:git push --set-upstream origin master
这样,之后再去git push就可以了。
详见:➜ http_restful_api git:(master) ✗ git commit -m "1. update makefile 2. update some content"
[master ab123ee] 1. update makefile 2. update some content
6 files changed, 72 insertions(+), 58 deletions(-)
➜ http_restful_api git:(master) git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
➜ http_restful_api git:(master) git push --set-upstream origin master
Counting objects: 17, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (17/17), done.
Writing objects: 100% (17/17), 2.38 KiB | 1.19 MiB/s, done.
Total 17 (delta 11), reused 0 (delta 0)
remote: Resolving deltas: 100% (11/11), completed with 9 local objects.
To https://github.com/crifan/http_restful_api.git
7ee92bf..ab123ee master -> master
Branch master set up to track remote branch master from origin.
➜ http_restful_api git:(master) git push
Everything up-to-date