首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使用终端在Github库中进行推送?

如何使用终端在Github库中进行推送?
EN

Stack Overflow用户
提问于 2016-10-14 11:01:05
回答 3查看 100关注 0票数 0

我正在尝试使用以下命令在Github中的现有存储库中进行推送,

代码语言:javascript
运行
复制
    git push -u origin master

我得到以下错误,

代码语言:javascript
运行
复制
    To https://github.com/Chaklader/Technical-Interview.git
! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'https://github.com/Chaklader/Technical-Interview.git'
    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.

正如它所暗示的那样,我尝试使用以下命令进行拉动,

代码语言:javascript
运行
复制
git pull origin master

这似乎也不起作用。如何解决这个问题?

EN

Stack Overflow用户

发布于 2016-10-14 11:11:43

您的本地主分支位于远程分支之后。

在添加本地更改之前,使用.first与远程同步

代码语言:javascript
运行
复制
git pull

(使用git log --oneline检查) .It应该与远程更改匹配您的主分支日志,如下所示。

代码语言:javascript
运行
复制
a570f1e design aptterns
607f53c added different deign patterns
c586b42 Update mySyntax.cpp
17ffb35 Update README.md
66e75d3 Update README.md
e66d701 update
3344773 first commit
0bd776c first commit
c1a0898 first commit
2468750 first commit

在上面的基础上,使用(push .then remote master分支)提交您的本地更改

代码语言:javascript
运行
复制
git push origin HEAD:refs/for/master
票数 1
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40034241

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档