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

experience installing "git-filter-repo" script directly within bare windows environment #124

Closed
t2t-paul opened this issue Jul 1, 2020 · 4 comments

Comments

@t2t-paul
Copy link

t2t-paul commented Jul 1, 2020

completely understand if all of this is just inexperience on my part and no updates to the installation instructions etc. are required, but i wanted to share a little trauma i had getting this excellent tool to work in windows.

my previous environment:

  • windows 10 pro version "1909"
  • Git version "2.27.0.windows.1"
  • neither a "package manager" nor python itself (as far as i was aware - certainly not installed by me) previously installed

(1) i installed python itself from here:
https://www.python.org/downloads/release/python-383/
selecting the "Windows x86-64 executable installer" option

... thus followed various undocumented struggles getting anything to work ("permission denied" etc. messages) including at one point following the advice here and disabling the "app execution aliases" settings for "python.exe" within "windows" / "apps & features" settings

(2) i then started again with a fresh unedited "git-filter-repo" file which i extracted directly from the "git-filter-repo-2.27.1.tar.xz" file provided in the releases section of this repository, using "https://extract.me/" to extract those files (".xz" is not recognised as an archive container), and placing that git-filter-repo file in my "c:\Program Files\Git\mingw64\libexec\git-core" path (i.e. the path returned by "git --exec-path" as per the installation instructions on this repo)

using Git Bash within the folder for the local repository I was trying to filter I then ran my desired command:

git filter-repo --path "Floating Till"

RESULT: error issued by Git Bash /usr/bin/env: ‘python3’: No such file or directory

(3) changed first line of script to "#!/usr/bin/env python" as per the advice in the installation section of this repo

RESULT: error issued by Git Bash /usr/bin/env: ‘python’: No such file or directory

(4) changed first line of script to "#!c:\Users\[my windows user name]\AppData\Local\Programs\Python\Python38\python.exe" i.e. the path where I found "python.exe" to be installed when I file-searched my system

RESULT: error issued by Git Bash fatal: 'filter-repo' appears to be a git command, but we were not able to execute it. Maybe git-filter-repo is broken?

(5) re-enabled the "app execution aliases" settings for "python.exe" within "windows" / "apps & features" settings

RESULT: error issued by Git Bash Python was not found but can be installed from the Microsoft Store: ms-windows-store://pdp/?productid=9NJ46SX7X90P

(6) googled that product id "9NJ46SX7X90P" on the microsoft store and installed python 3.7 directly from there

RESULT: it worked

my own feeling / conclusion is that maybe this was a Git Bash issue, and also that the only way to get it to work was by downloading python from the microsoft store itself

again i am quite a novice at adding packages to Git, and anything at all to do with PYTHON / UNIX etc.: just posting my own experience in case that is relevant to the installation processes documented here

@nickwesselman
Copy link

Thanks for sharing your trauma, these steps worked for me as well.

@aadibajpai
Copy link

I'm in the same boat, same errors, pip install git-filter-repo and manually creating the file in path give the same error. I'm not sure if I want to reinstall python since that'll break other stuff, might just use WSL but I can sympathize with you

@newren
Copy link
Owner

newren commented Oct 19, 2020

I updated INSTALL.md to point to this issue, issue 36, and a git mailing list thread about these python issues on Windows. I linked to this one first as it seems the most comprehensive to me. Thanks for providing these details for others!

@newren newren closed this as completed Oct 19, 2020
@raplemie
Copy link

raplemie commented Oct 22, 2020

I used pretty much the same steps that you did, except that for step 4, I found that I could use
#!/usr/bin/env C:\Users\[windows user name]\AppData\Local\Programs\Python\Python38\python (leave the /usr/bin/env and it started working at this point, I dont have the Store version installed. (only #!C:\... had the python stub issue)

So potentially, a shortened version of the workflow would be:
(1) Installing the downloaded python 3 version as above.
(2) Get a copy of the git-filter-repo in the --exec-path folder. (I cloned the repo and copied the file, but step above should have the same result.
(3) Update the shebang by replacing only "python3" to the full path of your python 3 executable

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

5 participants