0

I use a bare repo on a USB drive to work on a personal project at work and at home.

HOME: working on a Mac. Accidentally committing and pushing a badly named file containing *

WORK: try to git pull. Partly works OK, I get all necessary files to work with, but I also get the error "unable to create file XXX* (Invalid argument)".

Non-working solution: trying to delete bad file from bare repo with git push --force: tells me "you should pull first".

But, as seen above, git pull yields an error. Any suggestions on how to clean out this mess? Basically, I just want to "get into" the bare repo on my USB drive and delete the problematic file so that I can merge.

Community
  • 1
  • 1
tjoflong
  • 11
  • 4

1 Answers1

1

So, the last time you did a push was from your MAC.

Delete the file from your repo from your MAC:

git rm file1.txt

Then push your changes.

git commit -m "remove file1.txt"

This should solve your problem when you pull from your repo.

brokenfoot
  • 11,083
  • 10
  • 59
  • 80
  • Yeah, I realize that this might be "the obvious way to do it" --- thanks for the suggestion. And this is most lightly how I will pursue. But, now I am at work manipulating my files... and I want to bring my files back home in the evening. With your solution I have to go home (in the evening) and do git rm etc. Then I bring my "fresh USB repo" and do a merge at work tomorrow. It will work, but it is not "appealing" (hmm, I could just as well clone my working git repo over to the USB drive and merge everything tonight). – tjoflong Mar 03 '14 at 09:34
  • I guess that I do not want to "mess around" as suggested in my own comment. Couldn't one simply git rm the problematic file from the bare repo? That should be the *elegant solution*. Many thanks! – tjoflong Mar 03 '14 at 09:37