How do you install git-filter-repo?
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Life in a Drop
--
Chapters
00:00 Question
00:54 Accepted answer (Score 54)
01:50 Answer 2 (Score 17)
02:06 Answer 3 (Score 10)
03:05 Answer 4 (Score 3)
03:29 Thank you
--
Full question
https://superuser.com/questions/1563034/...
Question links:
https://github.com/newren/git-filter-rep...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#installation #python #git #sourcecontrol
#avk47
ACCEPTED ANSWER
Score 63
pip install
They now have a python package that just works:
python3 -m pip install --user git-filter-repo
That method installs both the command line executable, and the Python library which you can use as shown here.
The executable is named git-filter-repo
, and Git automatically picks up any executable in PATH
with name git-*
on calls like git *
, which is how this works.
Ubuntu 23.04
On this Ubuntu version or the one before, Ubuntu started adding the supremely annoying (but somewhat understandable) "error: externally-managed-environment" message to any pip install.
Thankfully they have a debian package for this one so you can:
sudo apt install git-filter-repo
Alternatively you can also override the error, or use a virtual environment, or the new pipx
thing: https://stackoverflow.com/questions/75608323/how-do-i-solve-error-externally-managed-environment-every-time-i-use-pip-3
sudo apt install pipx
pipx install git-filter-repo
which places the executable at ~/.local/bin/git-filter-repo
.
I juts don't understand why pip
stopped working with the good old --user
, why do they keep changing the interface every two years!!!
Manual install
If for some reason you don't want to use pip, you can also just:
# Add to bashrc.
export PATH="${HOME}/bin:${PATH}"
mkdir -p ~/bin
wget -O ~/bin/git-filter-repo https://raw.githubusercontent.com/newren/git-filter-repo/7b3e714b94a6e5b9f478cb981c7f560ef3f36506/git-filter-repo
chmod +x ~/bin/git-filter-repo
Tested on Ubuntu 20.04, git-filter-repo ac039ecc095d.
ANSWER 2
Score 19
On a Mac, you can install it using homebrew:
$ brew install git-filter-repo
ANSWER 3
Score 10
This is how I got it to work.
- Python should be installed and added to the system's path.
- Git should be installed and git also added to the system's path.
- Download git-filter-repo
- Replace 'python3' on first line of file called git-filter-repo with 'python'. Depending on your python installation, you may skip this step.
- Call git --exec-path
- Move the git-filter-repo file into that location shown. (git's path).
- To use, type git filter-repo. The help option will not work, but they have documentation online.
ANSWER 4
Score 4
On a Mac,
I simply downloaded https://github.com/newren/git-filter-repo/blob/main/git-filter-repo into my ~/local/bin (which was already on my path and where I keep all my batch files etc). After chmod +x git-filter-repo
, I just ran it from my repo dir like: git-filter-repo --path mydir
.