I've been having issues with adding files to my commits. In short, whenever I do git add , the files added to the unstaged commit are from the Git folder in my Program files dir (to clarify, I'm using an x64 version of windows 8). Regardless of what I do (git init, git clone...etc.), I have the same issue across all of my repositories. Is there something I'm missing? Also, this happens regardless of tool choice( git bash, powershell, cygwin, tortoise-git). If it helps, I'll also provide any snippets / images upon request. Update: Git deletes the repo files tracked and replaces them with files from ../Program Files/Git
.
Asked
Active
Viewed 1,058 times
1

RedX
- 7
- 3
-
So... what is your current directory when you do a `git add`? – Greg Hewgill Jul 24 '14 at 23:33
-
The current dir would be any of my working repos. For example, I'd be on C:\Users\Me\Repository(master), and none of the files in said repo would be tracked. The only files tracked are in my ..\Program Files\Git dir – RedX Jul 25 '14 at 01:15
-
1Take this as a constructive critique: it's kind of hard to understand your situation. I think the best you can do is appending a transcript of a terminal session showing how you create the repo (if applies), add and commit the files, and what `ls`/`dir`, `git status` and `git diff` show, for example, so we have more context. – mgarciaisaia Jul 25 '14 at 03:05
-
I have same issue - I recently install a bitcoin app (guiminer) that installed a torjan on my PC and I get this issue ever since. I removed the app, and scan for viruses - but still. – Elia Weiss Jul 06 '16 at 09:21
2 Answers
0
The only files tracked are in my ..\Program Files\Git
That could only happen if you have environment variable like GIT_WORK_TREE
which would "trick" git into considering the folder referenced by those environment variable as its working tree (instead of the current folder you are in).
See more at "What is GIT_WORK_TREE
, why have I never needed to set this ENV var, why now?"
0
I would suggest that the problem may be the way you "created" your repositories. Did you either:
git clone
url-of-some-repo name-of-local-dir create/change some files thengit add
orgit init
name-of-local-dir followed bycd
name-of-local-dir create some files,git add
those files- something else like just
mkdir some_name
and start trying to use git in it?
If you did not do one of 1 or 2 above you just have a load of files and git will not know where to put them because you don't have a repository and I guess you might see it default to where it is installed.

Steve Barnes
- 27,618
- 6
- 63
- 73
-
As said in the OP, I've used both `git init` and `git clone`, with the same result – RedX Jul 25 '14 at 12:20