11

I committed some files with a name containing ':' and '"' characters, which are invalid on Windows. When I try to git pull from a Windows machine it gives me an error message.

Is there a way to rename these files on the repo from the Windows machine? Or is there any other workaround?

Brad Werth
  • 17,411
  • 10
  • 63
  • 88
mtgred
  • 1,449
  • 14
  • 17
  • 2
    Is there a reason you can't clone the repo onto a Linux machine, rename the files, commit, and push? – cdhowie Dec 06 '10 at 10:05
  • 1
    I don't have access to a Linux machine where I am at the moment. Is there a way to do it from a Windows machine? – mtgred Dec 06 '10 at 11:22
  • I don't have a windows machine to fiddle on. How does the pull fail? Is it in a merge conflict state, where it's fetched the content but can't commit, or does it simply refuse to try? (And is the merge a fast-forward or not?) – Cascabel Dec 06 '10 at 15:14
  • I would recommend doing a `git fetch` instead of `git pull` and trying to work around the problem by only checking out commits which predate the rename. – Tyler Dec 07 '10 at 08:13
  • Using [git filter-repo](https://stackoverflow.com/a/43762489/1509695) to rewrite the history to exclude those file names may also be an approach, but not sure about affecting other users of the same repository in that case. – matanster Jun 16 '22 at 14:12

2 Answers2

4

If you have an access to a linux machine you can rename it, do the according changes into the code, and push to the repository (with appropriate comment)

Eineki
  • 14,773
  • 6
  • 50
  • 59
2

You could try doing a "sparse checkout" so that you don't check out those files on Windows.

https://stackoverflow.com/a/13738951/316578

Of course, this only works for you if it's okay not to have those files present on Windows.

Anthony Hayward
  • 2,164
  • 21
  • 17