2011-06-01 103 views
14

我已付出別人的Git倉庫:GIT - 推到(GitHub的)起源主無助

https://github.com/nippysaurus/toodledo-objc 

其克隆到我的本地機器上,顯示以下信息的來源:

* remote origin 
    Fetch URL: https://[email protected]/nippysaurus/toodledo-objc.git 
    Push URL: https://[email protected]/nippysaurus/toodledo-objc.git 
    HEAD branch: master 
    Remote branch: 
    master tracked 
    Local branch configured for 'git pull': 
    master merges with remote master 
    Local ref configured for 'git push': 
    master pushes to master (up to date) 

當我將更改推給「origin master」時,git會打印「所有內容都是最新的」,但沒有更新到我的GitHub倉庫中。

這是怎麼回事?

編輯:

有人建議我檢查大公的文件實際上COMMITED ...文件被COMMITED,我向你保證。

commit 0d3a21616d82c8e5a89baaf85d745fc2cfdf614f 
Author: nippysaurus <[email protected]> 
Date: Wed Jun 1 13:19:14 2011 +1000 

    updated readme 

這是被更新的文件:

commit 0d3a21616d82c8e5a89baaf85d745fc2cfdf614f 
Author: nippysaurus <[email protected]> 
Date: Wed Jun 1 13:19:14 2011 +1000 

    updated readme 

diff --git a/README.mdown b/README.mdown 
index fb8ee14..a71aa57 100644 
--- a/README.mdown 
+++ b/README.mdown 
@@ -3,7 +3,7 @@ toodledo-objc 

An _unofficial_ toodledo-API implementation in ObjectiveC. 

-This library currently uses [version 1.0 of the API](http://www.toodledo.com/info/api_doc.php "Toodledo API 1.0 spec") which has been offic 
+This library currently uses [version 1.0 of the API](http://www.toodledo.com/info/api_doc.php "Toodledo API 1.0 spec") which has been offic 

Supported: 

而且,我可以看到文件的本地版本,是在GitHub上的版本差別很大,變化肯定被添加到我的本地回購,但沒有推到遠程回購。

+0

您在哪個分支工作? 'git branch -va' – Tekkub 2011-06-01 05:23:49

+0

不是主分支。這可能是答案! :)任何人都在意把這個答案放到答案中,我會將其標記爲接受答案。 – Nippysaurus 2011-06-01 05:26:16

+0

你的願望是我的命令:d – ralphtheninja 2011-06-01 08:52:36

回答

29

這可能是你在另一個分支比主分支的情況下,然後鍵入:

git push origin HEAD:master 

所以git理解你想推高當前HEAD而不是主分支。

+0

天才小子!爲我節省了一些心痛。謝謝! – 2015-07-20 14:27:30

9

當它說,截至到目前爲止,這意味着你的本地倉庫和遠程倉庫是同一個,那就是你沒有做出需要推到遠程回購到本地的回購協議的任何改變。

如果你確實修改過的文件,那麼你必須忘了提交。

如果你創造了新的文件,則必須添加它。要添加文件使用

git add . 

然後提交所有編輯的文件使用

git commit -am "Commit message" 

然後做

git push origin master 
+2

請格式化使用四個空間縮進或反引號在適當情況下你的答案。謝謝! – 2011-06-01 03:38:04

+0

該文件明確被添加到提交中。我已更新我的原始問題以包含此信息。 – Nippysaurus 2011-06-01 04:18:18

1

使用此命令。假設test.md是您創建的新文件,並且想要用消息「測試」推送它。

$ git add test.md 
$ git commit -a -m "Testing" 
$ git push origin master 
+0

只是簡單的做這樣的過程: - 1)提交你的本地倉庫中有該用這個命令: - git的承諾-am「進入更新的消息要顯示」 2)推動混帳 混帳推變化起源HEAD:主 如果我們同時使用這兩個命令,它會更新所有更新的更改。 – ravinder521986 2017-02-17 12:16:26