git 部署项目 - 隐藏警告
我正在使用 git 部署我的网站,但是,我试图弄清楚为什么使用以下内容 脚本,文件不断累积在我的工作副本
列表中。这意味着,我提交并推送到裸存储库的每个不同文件都会列出为: 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
谢谢
I'm using git
to deploy my site, however, I'm trying to figure out why using the following script, files keep accumulating in my list of working copy
. Meaning that, every different file that I commit and push to my bare repository gets listed as: M filename.php
Also, I'm wondering what does the following warnings mean? and how can I avoid them?
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
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这意味着您的目标存储库不是裸露的(即有一个
.git
以及签出的工作副本),不是“干净的”:“git status”不会在该远程存储库上返回干净状态,例如“
无需提交任何内容(工作目录干净)
”。这就是为什么您会看到隐藏警告(Git 尝试保存“正在修改”的文件)。
在运行之前,您首先需要确保远程存储库具有干净的状态(通过将其工作树重置为部署分支上的最新提交,确保 git 分支表明您位于该分支上)这个脚本。
This means your destination repo, which isn't bare (i.e. there is a
.git
plus a working copy checked out), isn't "clean": the "git status
" would not return on that remote repo a clean status, like "nothing to commit (working directory clean)
".That is why you see stashing warning (Git tries to save the files "being modified").
You need first to make sure the remote repo has a clean status (by resetting its working tree to the latest commit on the deployment branch, making sure a
git branch
indicates that your are on that branch) before running this script.为什么不让
hooks/post-receive
脚本执行git checkout -f
来让它从裸存储库签出到部署路径呢?看看我是如何做到的。
Why not you just make the
hooks/post-receive
script do agit checkout -f
to have it do a checkout from a bare repository into the deployment path?Take a look on how I did it.