gpt4 book ai didi

linux - Git 困惑。 "fatal: failed to open ' app/lang/en/homepage.php': File exists"

转载 作者:太空宇宙 更新时间:2023-11-04 03:39:55 24 4
gpt4 key购买 nike

有一天,由于 git 遇到问题,我不得不对我们的一台生产服务器进行完整的镜像恢复,并且不知道如何解决该问题。标准工作流程已经运行了近 2 年,没有出现任何问题:

  • 进行本地更改
  • 提交
  • 完成功能 (GitFlow)
  • 推送到远程源
  • 登录服务器,转到 http root 并发出以下命令:

    git pull master Version_1.x.x

但是,这一次我没有像往常一样工作,而是遇到了这个错误。

fatal: failed to open 'app/lang/en/homepage.php': File exists

该文件与其他几个文件一样在 dev 中进行了更新。我立即收到服务器监控通知,该网站不再响应。所以我加载了它,但出现了 404 错误??

返回控制台 git status并对所展示的内容感到震惊。

On branch master
Changed but not updated:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: app/views/layouts/landingBody.blade.php
modified: app/views/layouts/trailblazers.blade.php
modified: app/views/mobile/UI/landingBody.blade.php
modified: public/images/spashPage_full_new.jpg

Untracked files:
(use "git add <file>..." to include in what will be committed)

public/images/3rd_Party/
public/images/UI_bg_login_summer2015.jpg
public/images/spashPage_full_1024_summer2015.jpg
public/images/spashPage_full_1200_summer2015.jpg
public/images/spashPage_full_blur_summer2015.jpg
public/images/spashPage_full_summer2015.jpg

no changes added to commit (use "git add" and/or "git commit -a")

文件在生产中已被更改,并且属于最新更新的文件被报告为未跟踪文件,这怎么可能?

因此,我尝试 stash 更改,这些更改可预见地在下一个 git status 上返回以下内容

On branch master
nothing to commit (working directory clean)

我尝试了从硬重置到重置到特定提交的所有方法,但情况逐渐变得更糟,直到我得到的程度。

我遇到了诸如

之类的错误
git reset --hard ORIG_HEAD
error: git checkout-index: unable to create file app/3rdParty/Mobile_Detect.php (File exists)
error: git checkout-index: unable to create file app/config/app.php (File exists)

不知道还能做什么,我从快照进行了完整恢复。现在我回到了上次备份,该备份距今不到 16 小时,并且此后没有进行任何其他更改,我执行了 git status在同一台生产机器上。只是为了在实际发出另一个 git pull 命令并再次搞乱一切之前进行检查。结果如下:

On branch master
Changed but not updated:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: public/.htaccess

Untracked files:
(use "git add <file>..." to include in what will be committed)

app/config/auth.php
app/config/cache.php
app/config/compile.php
app/config/database.php
app/config/remote.php
app/config/session.php
app/views/emails/
app/views/hello.php
bootstrap/compiled.php
readme.md
no changes added to commit (use "git add" and/or "git commit -a")

这怎么可能呢?除了git pull <local branch> <origin branch>之外,生产中什么也没做。 ,但还有未跟踪的文件和已修改的文件。

我有需要“推送”到生产中的更新,但我不能让网站再次关闭。不是 git 专家使得这变得特别困难。

我确实检查了生产环境中的 git 日志,并将其与原始版本进行了比较,开发和提交都匹配。这一切都非常令人困惑。

任何帮助将不胜感激。

最佳答案

问题出在 Dropbox 内。其中一个子目录的 .gitignore 文件已被删除并替换为备用版本,并且在以前的版本中无意中推送。下次更新的时候一切都完全不正常了。用正确的版本替换 .gitignore 文件并进行硬重置,然后 pull 解决了问题。教训:当 Dropbox 与 git 在同一个沙箱中运行时,可能会很危险。

关于linux - Git 困惑。 "fatal: failed to open ' app/lang/en/homepage.php': File exists",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30158534/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com