Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git issues with Laravel Forge

I'm deploying my web app using Laravel Forge and BitBucket. Recently I was coding one part of my website, and I noticed that I made small mistake in CSS, since I couldn't use git push because I'm not finished with coding, I changed that CSS using FTP. So after I finished with development, I tried to git push but I got this error (in Laravel Forge logs):

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

After I searched internet I found out that stashing would solve the problem so I changed deploy script to this:

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

But now I receive this error:

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  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 <[email protected]>) 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

Can someone help me to fix this?

like image 615
Alen Avatar asked Nov 23 '25 18:11

Alen


1 Answers

When I have to make small fixes on the server like this, my standard procedure is that once I get the fix rolled into my code, run git checkout -- [filename] or git checkout -- . to reset either the changed file or all files (if you've been mucking around in many places).

I've never tried the git stash method, but your server shouldn't really be a working directory, it should just receive your code.

Also, branch early, branch often. Developing in a feature branch would have let you git checkout master, make and push your fix, git checkout feature-branch, then git merge master to bring your fix into your feature branch and continue coding without changing files directly on the server.

like image 109
CJ Thompson Avatar answered Nov 25 '25 10:11

CJ Thompson