最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】gitbook代码去git push –set-upstream origin master死掉没反应

Git crifan 6556浏览 0评论

之前已经用Gitbook Editor中去同步和上传代码到远程:

https://github.com/crifan/http_restful_api

了。

更新代码后,然后去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:fatal the current branch master has no upstream branch – CSDN博客

试试:

git push -u origin master

好像和:

git push –set-upstream origin master

是一样的,还是停滞不前:

git – fatal: The current branch master has no upstream branch – Stack Overflow

去试试:

➜  http_restful_api git:(master) git remote add origin https://github.com/crifan/http_restful_api

fatal: remote origin already exists.

再去:

➜  http_restful_api git:(master) git pull –rebase https://github.com/crifan/http_restful_api

From https://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

Git push hangs when pushing to Github? – Stack Overflow

试了:

➜  http_restful_api git:(master) git config –global core.askpass “git-gui–askpass”

结果问题依旧。

➜  http_restful_api git:(master) git remote -v

origin    https://github.com/crifan/http_restful_api.git (fetch)

origin    https://github.com/crifan/http_restful_api.git (push)

git push origin master dead

github – Why git push origin master goes dead? – Stack Overflow

解决failed to push some refs to git – Marvel__Dead 胡艺宝的博客 – CSDN博客

如何解决failed to push some refs to git – Marvel__Dead 胡艺宝的博客 – CSDN博客

Let’s all take a moment of silence… git pull is dead. (Example)

那就继续去试试:

➜  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.

To https://github.com/crifan/http_restful_api.git

   4d65b1d..7ee92bf  master -> master

【总结】

此处,不知道是网络还是其他原因,本身通过:

git push origin master

应该很快上传代码的,结果却中途死掉的感觉。

最后是等待足够长时间(具体不知道多长时间,反正是2多个小时候后)是成功上传了的。

【后记】

后来,去commit后的push就很正常了,且用的是:

<code>git push --set-upstream origin master
</code>

这样,之后再去git push就可以了。

详见:

<code>➜  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 -&gt; master
Branch master set up to track remote branch master from origin.
➜  http_restful_api git:(master) git push
Everything up-to-date
</code>

转载请注明:在路上 » 【已解决】gitbook代码去git push –set-upstream origin master死掉没反应

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.192 seconds, using 22.20MB memory