【问题标题】:Git issues with Laravel ForgeLaravel Forge 的 Git 问题
【发布时间】:2015-05-13 12:02:11
【问题描述】:

我正在使用 Laravel Forge 和 BitBucket 部署我的网络应用程序。最近我正在编写我网站的一部分,我注意到我在 CSS 中犯了一个小错误,因为我没有完成编码,所以我无法使用 git push,我使用 FTP 更改了那个 CSS。所以在我完成开发后,我尝试git push,但我得到了这个错误(在 Laravel Forge 日志中):

error: Your local changes to the following files would be overwritten by merge:

在我搜索互联网后,我发现存储可以解决问题,所以我将部署脚本更改为:

cd /home/forge/default
git stash
git pull origin master
git stash apply stash@{0}
composer install
php artisan migrate --force

但现在我收到此错误:

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for <forge@objavi.net>) not allowed
Cannot save the current index state
From bitbucket.org:alenn/objavi
 * branch            master     -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
    app/models/Post.php
    app/models/User.php
    app/routes.php
    app/views/home.blade.php
    app/views/layouts/partials/top.blade.php
    app/views/main.blade.php
    public/css/main.css
    public/js/script.js
Please, commit your changes or stash them before you can merge.
error: The following untracked working tree files would be overwritten by merge:
    app/views/users/readlater.blade.php
Please move or remove them before you can merge.
Aborting

有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: git bitbucket laravel-forge


    【解决方案1】:

    当我必须像这样在服务器上进行小修复时,我的标准程序是,一旦我将修复纳入我的代码,运行 git checkout -- [filename]git checkout -- . 以重置更改的文件或所有文件(如果你已经在很多地方乱七八糟了)。

    我从未尝试过git stash 方法,但您的服务器不应该是真正的工作目录,它应该只是接收您的代码。

    另外,早分支,经常分支。在功能分支中进行开发可以让您 git checkout master,制作并推送您的修复程序,git checkout feature-branch,然后 git merge master 将您的修复程序带入您的功能分支并继续编码,而无需直接更改服务器上的文件。

    【讨论】:

      猜你喜欢
      • 2015-12-07
      • 2014-10-16
      • 2015-06-13
      • 2016-09-22
      • 2016-09-05
      • 2016-10-16
      • 2020-02-26
      • 2020-06-17
      • 2018-06-05
      相关资源
      最近更新 更多