2014-10-04 51 views
0

我想在git上提交一个新文件。Git commit not Github同步

我使用下面创建一个新的文件在我的回购: 触摸的help.txt 混帐添加的help.txt git的承诺 混帐推

But it did not reflect in the github repo while the file is there in local repo.

+0

您必须添加更多的细节。 'git push'的输出是什么?你能通过'git show'确认文件已经提交吗? – jcm 2014-10-04 09:48:53

+0

嗨jcm,我得到了下面的输出:到https://github.com/Puneet1/MyProject1! [已拒绝]主 - >主(非快进)错误:无法将某些引用推送到'https://github.com/Puneet1/MyProject1'提示:更新被拒绝,因为当前分支的提示位于提示后面:它的远程对手。在再次推送之前,集成远程更改(例如,提示:'git pull ...')。提示:有关详细信息,请参阅'git push --help'中的'关于快速转发的注意事项'。 – 2014-10-04 11:04:09

+0

git show given:diff --git a/readme.txt b/readme.txt index e69de29..764a3dc 100644 --- a/readme.txt +++ b/readme.txt @@ -0,0 +1 @ @ + Hello Puneet \文件末尾没有换行符 – 2014-10-04 11:06:40

回答

1

的原因及解决办法是在git push输出。

Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. 'git pull ...') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details.

您的更改被远程拒绝,因为它的变化是您的本地分支没有更改。 你可以做

git pull --rebase origin name-of-branch-you-want-to-push-to git push origin name-of-branch-you-want-to-push-to

+0

执行此操作时是否需要在线并登录到我的Git Hub帐户?我是Git和GitHub的新手,对我来说这是一条学习曲线。 – 2014-10-04 11:33:25

+0

我尝试了Git fetch,然后git rebase并转到响应“没有当前分支的跟踪信息” – 2014-10-04 11:36:30

+0

您需要连接到Internet,但不需要登录到GitHub。 – jcm 2014-10-04 11:36:32