2011-06-04 162 views
2

我使用git部署我的網站,但是,我試圖找出爲什麼使用以下script,文件不斷累積在我的列表中working copy。這意味着,我承諾並推送到我的裸存儲庫的每個不同的文件被列爲:M filename.phpgit部署項目 - 存儲警告

此外,我想知道以下警告是什麼意思?我該如何避免它們?

To [email protected]:/home/www/site1/.git 
    07155f1..e80c2db master -> master 
Push to checked out branch refs/heads/master 

W:unstaged changes found in working copy 
W:stashing dirty working copy - see git-stash(1) 

Saved working directory and index state "On (no branch): dirty working copy before update to e80c2db3212a7eb33da2e218001122e0decae640" 

Checking out files: 100% (6362/6362), done. 
HEAD is now at 07155f1 updated file path 
trapped 22921 
Updating working copy 
M  image.php 
M  ask.php 
M  basic.php 
HEAD is now at e80c2db updated text style 

感謝

回答

2

這意味着你的目的地回購,這是不裸露(即存在.git加上工作拷貝簽出),是不是「乾淨」了:「git status」不會返回該遠程回購清理狀態,如「nothing to commit (working directory clean)」。

這就是爲什麼你看到存儲警告(Git試圖保存文件「被修改」)。

在運行此腳本之前,您需要首先確保遠程repo具有乾淨狀態(通過將其工作樹重置爲部署分支上的最新提交,確保git branch指示您在該分支上)。

+0

從VonC的評論 - 也許你需要使回購裸露,以便它保持乾淨,而不是在該回購工作的東西 - 你/其他人實際上做的回購工作... ... – 2011-06-04 18:28:22

+0

@Philip Oakley:是的,其實這就是我的想法。我已經看到了使用git完成部署的幾種方法,但是,我仍然試圖找出最佳方式。有任何想法嗎? – 2011-06-04 21:36:39

+0

@Philip Oakley:不,我是唯一一個在該存儲庫上工作的人。 – 2011-06-04 21:43:17

0

爲什麼不只是讓hooks/post-receive腳本做一個git checkout -f讓它從裸倉庫檢出到部署路徑?請參考how I did it