Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refusing to destructively overwrite repo history since #522

Open
robert-elles opened this issue Nov 26, 2023 · 4 comments
Open

Refusing to destructively overwrite repo history since #522

robert-elles opened this issue Nov 26, 2023 · 4 comments

Comments

@robert-elles
Copy link

Hello,
running git-filter-repo --path git-crypt --invert-paths
I get:

Aborting: Refusing to destructively overwrite repo history since
this does not look like a fresh clone.
  (you have untracked changes)
Please operate on a fresh clone instead.  If you want to proceed
anyway, use --force.

I get this on a repo that was just cloned. Using --force will corrupt my repo and remove the remote repo.

@noremacskich
Copy link

noremacskich commented Jan 19, 2024

For others that come across this, I found out that untracked changes does include any files / folders that .gitignore might be ignoring.

To see those, run this command

git status --ignored

In my case, there was a node_modules folder among others that got automatically added with the IDE I was using to clone the repo.

Once I removed those, it worked

@jjanuszkiewicz
Copy link

I have a completely clean repo and it still complains, any idea why that could be?

$ git status --ignored
On branch master
nothing to commit, working tree clean

$ git-filter-repo --path [...]
Aborting: Refusing to destructively overwrite repo history since
this does not look like a fresh clone.
  (expected freshly packed repo)
Please operate on a fresh clone instead.  If you want to proceed
anyway, use --force.

@jjanuszkiewicz
Copy link

Worked just fine with --force, not sure what the problem was.

@alissa-huskey
Copy link

Just in case anyone else was running into this problem due to __pycache__ directories somehow being created in between removing the directory and running git-filter-repo again, you can disable the generation of those directories.

export PYTHONDONTWRITEBYTECODE=1
find . -type d -name __pycache__ -exec rm -r {} \+
git-filter-repo --path [...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants