问题描述
|
我正在使用“ 0”来部署我的网站,但是,我试图弄清楚为什么使用以下脚本,文件会不断累积在我的“ 1”列表中。这意味着,我提交并推送到裸存储库的每个不同文件都列为:
M filename.PHP
另外,我想知道以下警告是什么意思?以及如何避免它们?
To mike@server10:/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
谢谢
解决方法
这意味着您的目标存储库不是裸露的(即,有一个
.git
加上已签出的工作副本),不是\“干净\”:\“git status
\”将不会在该远程存储库上返回干净的状态,例如\“nothing to commit (working directory clean)
\”。
这就是为什么您看到隐藏警告(Git尝试“正在修改”保存文件)的原因。
在运行此脚本之前,您首先需要确保远程仓库处于干净状态(通过将其工作树重置为Deployment分支上的最新提交,并确保“ 7”表示您在该分支上)。
, 为什么不让hooks/post-receive
脚本执行git checkout -f
以使其从裸存储库签出到部署路径呢?
看看我是如何做到的。