2014-10-04 63 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