2012-10-30 112 views
1

我完成提交併推送遠程git存儲庫上的更改,但是當我查看遠程存儲庫的文件時,這些文件已過時。我正在使用Git Bash。我如何更新遠程git存儲庫上的更改?

View image

的紅色文字是在倉庫克隆所做的更改。這些更改未反映在原始存儲庫的物理文件中

我如何才能反映這些更改?

+0

您的推送成功了嗎?你的命令的結果可能是有用的。 –

+0

奇怪......當克隆服務器存儲庫時,我可以獲得最後一次提交的更改。但是當我查看服務器存儲庫中的文件時,它並未發生變化......我使用Egit來推送更改......一切看起來都正確 –

+0

您可以發佈帶有以'.png'結尾的地址的圖片嗎?我將能夠在你的問題中爲你導入它。但我看不到tinypic.com在工作(被阻止) – VonC

回答

2

我認爲你正在推送到遠程當前檢出的分支。因爲它看起來像一個非裸倉庫,並在你的描述中檢出了文件。

我做了一些簡單的測試來模擬這種推,和下面的消息顯示:

remote: error: By default, updating the current branch in a non-bare repository 
remote: error: is denied, because it will make the index and work tree inconsistent 
remote: error: with what you pushed, and will require 'git reset --hard' to match 
remote: error: the work tree to HEAD. 
remote: error: 
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to 
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into 
remote: error: its current branch; however, this is not recommended unless you 
remote: error: arranged to update its work tree to match what you pushed in some 
remote: error: other way. 

如果你確定你做成功的推動(這將是拒絕在默認情況下),那麼你必須在遠程存儲庫執行以下操作。

git reset --hard 
+0

感謝您的幫助=)。我的錯誤是創建服務器存儲庫作爲正常的存儲庫,而不是作爲裸倉庫。我不知道關於裸存儲庫......順便說一句,在裸倉庫中,文件存儲在二進制文件中?我沒有看到工作目錄 –

+0

裸倉庫中只有提交對象,通常你不會永遠簽出遠程倉庫上的任何文件,它唯一的工作就是保存提交。如果您想將其部署到集中式開發環境或每次推送時使用,也許可以在裸存儲庫中添加一個掛鉤來爲您執行此操作。除此之外,你會在hook後更新或post-receive,這取決於你的git版本。 – nevermind

相關問題