2011-06-04 240 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