Git reports changed files on Windows 8 - windows

I have been struggling with this git problem.
The problem is that when I do a fresh clone from GitHub, git reports that some files has changed although I have not touched them.
Often this happens when I switch branches as well. If I go from an unmodified master to another branch and back to master, it says files has been changed in master.
I have been reading about line endings and tried just about everything in that category, but nothing seems to help.
The repository is https://github.com/seesharper/LightInject is case someone would like to try and see if they have the same problem.
A friend of mine had the exact same problem with the same repository on his Windows 8 machine. Then he tried it on Windows 7 and the problem went away.
Does anybody know of any issues with using git on windows 8.
I have also tried this on another Windows 8 machine and it has the same problem.

I've dealt with this issue in the past - keep in mind that most git installations run on non-windows servers. There's a distinct possibility that what Windows is seeing is actually something where the "filemode" of the file is different than what Linux expects, therefore it sees the file as changed.
Poking around on the internet, there may be a way to fix the filemode issue - but nothing on google is jogging my memory at the moment. I skimmed over this, maybe something in it will help?
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/0EdNev3NNsw
I can't promise the above has a silver bullet for you, but it seems like there's good discussion about how Windows filemode messes up git indexes, sometimes.

I experienced the same issue with Windows 7. This is something I did to resolve (you might try):
git clone git#github.com:seesharper/LightInject.git
cd LightInject
git status
git checkout -f -b mine HEAD~
git status
git checkout master
git status
git branch -D mine

Related

Git Errors with interactive rebase. Unable to move the cache: Access is denied

I'm using Git on windows on version 2.38.1
I'm currently having some errors when I'm trying to do an interactive rebase. Fortunately the operation still works at least. Here are the errors :
I tried the following:
Delete the cache folder. This only brought more issue where I was not able to clone repos
reinstalled git for windows. This solved some of the issue but I still have the errors that are in the screenshot
I found a couple of forum/blog that gave me things to try bu as of now it always led me to another dead end.
Would anyone have a clue on how I could get rid of those errors?
Thank you in advance for the help
Try first to make the git rebase -i from a simple CMD session, not from an editor (like VSCode) to see if the issue persists.
Do that in a local cloned repository in C:\users\macaron\myRepository (replace myRepository with your actual repository name).
If it works outside an IDE, but not inside, then, as seen here, it is probably due to a concurrent process which keeps an handle on those resources (Cache folders), preventing the git command to proceed.

Git Extensions "function not implemented"

I'm trying to use Git Extensions on a new Windows 7 machine. I have done that many times before but never hit this particular issue.
Git Bash is working, I successfully cloned a repository.
But going to Git Extensions, opening the repo, and doing a pull gives me the following error message:
"C:\Program Files (x86)\Git\bin\git.exe" pull --progress "origin"
error: cannot spawn git: Function not implemented
Done
Press Enter or Esc to close console...
My setup is very ordinary. The Git Extensions startup checks all pass. (This is similar but not the same problem as the common invalid path issue.)
Do you have any idea what causes this problem?
The new releases, Git for Windows 2.16.1(3) and Git for Windows 2.16.1(4), fix this regression:
2.16.1(3) Bug Fixes
When http.sslBackend is not configured (e.g. in portable Git or MinGit), fetch/push operations no longer crash.
On Windows 7 and older, Git for Windows v2.16.1(2) was no longer able to spawn any processes (e.g. during fetch/clone). This regression has been fixed.
The Perl upgrade in v2.16.1(2) broke git send-email; This has been fixed by updating the Net-SSLeay Perl module.
The mentioned regression in the second bullet point is exactly the error this question is about.
Unfortunately, there was one missing issue about spawning processes which was then fixed in the subsequent fourth release:
2.16.1(4) Bug Fixes
When called from TortoiseGit, git.exe can now spawn processes again.
Note that the download on https://git-scm.com/download/win might not have been update yet, so you need to download it from gitforwindows.org or directly from the release page on GitHub.
Afterwards, you can verify that you indeed running the new version using git --version which should report git version 2.16.1.windows.4.
Per Philippe and Jake - bug is filed against GIT 2.16.2, and workaround is to go back to prior version.
https://github.com/git-for-windows/git/releases/tag/v2.16.1.windows.1
Running an update on my machine to Git for Windows v2.21.0- just a slightly updated version fixed the issue with my Windows 7 installation at work.
https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/Git-2.21.0-32-bit.exe

Does VSCode come with git itself?

The documentation says plain as day that VSCode does not come with git, that it leverages your machine's git installation and you must install it.
HOWEVER, it worked just fine for me. I only had github desktop and I am absolutely positively sure that I did not have git for windows installed and github desktop did not place itself in my PATH. (Technically I did have git on Bash on WSL but I know vscode isn't/can't access that). And yet it worked just fine for the longest time.
So, my question is, did vscode come with its own git executable? I ask because ever since I set up 2 factor auth on my github account I've been having to manually log in each time I push, it doesn't use my SSH keys stored in username/.ssh like git shell does.
Github Desktop installs git for you, typically located "C:\Program Files\Git", which is what VSCode, in your case, is most likely using.
If you refer to the answer from this post:
VSCode Terminal + Git Bash "command not found" for any command
it shows the settings (settings.json) that you need to add to allow for git bash and login to be used.
Hopefully this helps!

Git push halts on “Writing Objects: 100%” on Windows 7

When I try to push new file into Git repository, it doesn't finish, on screen is my workflow:
I tried:
TortoiseGit 1.8.1.0 (git version 1.8.0.msysgit.0 (C:\Program
Files\Git\bin))
Eclipse EGit 2.1.0
Command line
without any success. I read this question, but it's quite old (1.5 year), and do not help (I installed git 1.7.4), and was the same. I new in Git, please tell me what am I doing wrong or how to solve it? What do you suggest as a Git client for Windows 7 (32)? (Best if it will support command line).
Pushing over the Git-protocol is still broken in Git for Windows. So if that's what you're attempting, check if you can push over another protocol instead.
I had this problem today. I pulled and then tried to push to the remote, and it got to 100% writing objects and just stayed there. It didn't request the repo password, nothing.
The solution was related to my .gitconfig file. I had to redo the settings in this file.
I think in mucking around with my git repository (and admittedly learning how git works by breaking it) I had inadvertently removed this file.

msysgit error with hooks: "git error: cannot spawn .git/hooks/post-commit: No such file or directory"

I'm having trouble getting post-recieve and post-commit hooks to work correctly with msysgit (Windows 7 Pro/32 and Ultimate/64). For post-commit hook I get the above error if I commit from either git-bash or the console, but it works fine if I commit through git-gui. For a post-recieve hook, all three give the same error.
I'm thinking this is some sort of permission or path error, but don't really have any clue where to start here.
Add the SHEBANG to the first line of hook, like so:
#!/bin/sh
echo "executing post-commit"
exit 0
This had me stumped for a while as well and I saw that adding the shebang fixed it. In SVN world, while in *nix we have a "pre-commit" script and in Windows we had "pre-commit.bat" and SVN automatically picked up the bat file in Windows. Git doesn't seem to pick up a pre-commit.bat ( or any hook ) and adding the shebang to the hook file worked.
I'm using SourceTree and git LFS and had a similar issue: cannot spawn .git/hooks/pre-push.
The fix was to delete the pre-push file (opening it revealed it was badly corrupted) and restart SourceTree at which point it regenerates the pre-push file and everything is back to normal.
If you have the SHEBANG and it still fails, make sure you have <path_to_git>\bin set in your path environment variable.
You'll probably also have <path_to_git>\cmd if you installed it to work from the command-line.
This is an old question, but I've been fighting with this exact problem and this SO question popped up, so I thought it worth the effort to record what worked for me.
In short: I needed to run Apache as a regular user instead of Local System. This was on a legacy test VM I was playing with, so it was only running Windows XP, but it appears that at least on that platform (and possibly others), msysgit just doesn't work properly when running under the Local System account (presumably the root filesystem isn't mapped properly). As a result, no shebang line will work as git-http-backend simply can't execute any msysgit binaries (even with absolute Windows paths).
Switching Apache to run as a regular user account fixed this problem completely. Obviously you need to ensure that the user Apache is running as has permissions to read/write the git repositories, but beyond that, just make sure your shebang line is #!/bin/sh and everything should be copacetic.
Lastly, yeah, this is a big hammer. Ideally you'd be able to use something like suexec on Windows, but a quick googling doesn't indicate an obvious path forward, there. Of course, if anyone has any ideas, I'd be interested.
For now, this works for me, but it doesn't seem ideal.
Got this in a repo using LFS, got rid of it with git lfs update --force
If someone, like me run into a similar problem with accessing git repositories through apache, you should set the PATH in Apache config, like:
SetEnv PATH "c:/Program Files (x86)/Git/bin;"
Using tortoisegit and LFS, for me just had to remove the files inside of the .git/hooks folder.
If you are using Android studio, you can remove this error by un-check the checkbox "Run Git hooks":
For me, removing a comment line on front of the shebang line fixed the error. Oddly, the script ran fine from the shell, just errored out when run as a hook.

Resources