1

I'm using macOS Catalina. No Matter what I try, I get a commit error. I've already tried:

git rm -rf --cached <path-to-file> 

Here is me trying to add and then commit:

 ➜  payments git:(eric/refactorsalfailworker) ✗ git st
On branch eric/refactorsalfailworker
Your branch is up to date with 'origin/eric/refactorsalfailworker'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    pkg/payments-webhooks-worker/helpers-deposit-fail.go
        deleted:    pkg/payments-webhooks-worker/helpers-deposit.go
        modified:   pkg/payments-webhooks-worker/helpers-go-routines.go
        deleted:    pkg/payments-webhooks-worker/helpers-monthly-payment.go
        deleted:    pkg/payments-webhooks-worker/helpers-mvr.go

no changes added to commit (use "git add" and/or "git commit -a")
➜  payments git:(eric/refactorsalfailworker) ✗ git add .
➜  payments git:(eric/refactorsalfailworker) ✗ git commit -m 'added prev boolean'
stat pkg/payments-webhooks-worker/helpers-deposit-fail.go: no such file or directory
stat pkg/payments-webhooks-worker/helpers-deposit.go: no such file or directory
stat pkg/payments-webhooks-worker/helpers-monthly-payment.go: no such file or directory
stat pkg/payments-webhooks-worker/helpers-mvr.go: no such file or directory
COMMIT FAILED
➜  payments git:(eric/refactorsalfailworker) ✗ git st
On branch eric/refactorsalfailworker
Your branch is up to date with 'origin/eric/refactorsalfailworker'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        deleted:    pkg/payments-webhooks-worker/helpers-deposit-fail.go
        deleted:    pkg/payments-webhooks-worker/helpers-deposit.go
        modified:   pkg/payments-webhooks-worker/helpers-go-routines.go
        deleted:    pkg/payments-webhooks-worker/helpers-monthly-payment.go
        deleted:    pkg/payments-webhooks-worker/helpers-mvr.go

The add . is definitely working, but git for some reason just isn't allowing the commit. When I run the rm -rf --cached it says it can't find the file. It tried it with full path and relative path.

Eric Grossman
  • 219
  • 1
  • 4
  • 9
  • Possible duplicate of https://stackoverflow.com/questions/40178828/git-no-such-file-or-directory - Mentions either to enable long path names for git or add your folder to "allowed apps" for the windows controlled folder feature. – zrrbite Sep 16 '20 at 21:09
  • 1
    What OS are you running ? Can you add the output of `git st` after your `git add .` ? – LeGEC Sep 16 '20 at 21:14
  • @LeGEC just added, using macOS Catalina – Eric Grossman Sep 17 '20 at 01:32
  • @zrrbite looks like that question is specifically about Windows, this is on macOS – Eric Grossman Sep 17 '20 at 01:33
  • 3
    This is a problem with one of your hooks, probably a `pre-commit` hook. If you don't want to use that hook, delete it from `.git/hooks`; otherwise, include the hook and any relevant details in your question. – bk2204 Sep 17 '20 at 01:40
  • @bk2204 that was it, thanks!! – Eric Grossman Sep 17 '20 at 03:47

1 Answers1

1

As I mention in "Skip Git commit hooks", it is preferable to:

  • try a git commit -n -m "..." in order to avoid any pre-commit and commit-msg hooks.
  • then try and edit the culprit hook, making it more robust (in this instance, detect any deletion file and not operate on those files, since they are no longer in the working tree)
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250