【问题标题】:git deploying project - stashing warningsgit部署项目 - 隐藏警告
【发布时间】:2012-11-01 03:16:54
【问题描述】:

我正在使用git 来部署我的站点,但是,我试图弄清楚为什么使用以下script,文件不断累积在我的working copy 列表中。这意味着,我提交并推送到我的裸存储库的每个不同文件都被列为: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 deployment push


    【解决方案1】:

    这意味着您的目标仓库不是裸露的(即有一个.git 加上一个签出的工作副本)不是“干净的”:“git status”不会在该远程仓库上返回干净的状态,例如“nothing to commit (working directory clean)”。

    这就是您看到存储警告的原因(Git 尝试保存“正在修改”的文件)。

    在运行此脚本之前,您首先需要确保远程 repo 处于干净状态(通过将其工作树重置为部署分支上的最新提交,确保 git branch 表示您在该分支上)。

    【讨论】:

    • 根据 VonC 的评论——也许你需要让回购裸露以保持清洁,而不是在那个回购上工作——你/其他人真的在回购上工作吗....
    • @Philip Oakley:是的,实际上我就是这么想的。我已经看到了几种可以使用 git 完成部署的方法,但是,我仍在尝试找出可能的最佳方法。有什么想法吗?
    • @Philip Oakley:不,我是唯一一个在那个仓库工作的人。
    • @Mike:替代方案基于裸仓库和更新后挂钩:stackoverflow.com/questions/3753520/…stackoverflow.com/questions/2062657/…
    【解决方案2】:

    为什么不直接让hooks/post-receive 脚本执行git checkout -f 让它从裸存储库检出到部署路径?

    看看how I did it

    【讨论】:

      猜你喜欢
      • 2016-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多