Reputation: 28325
I can't get this to work.
I have cloned a repository that has a dummy file (named src): /path/src
.
On Windows I have created a symbolic link: mklink -d /path/src /otherplace/src
(but I of course had to delete the dummy src file first).
In both my .gitignore
and .git/info/exclude
I have
/path/src/
/path/src
path/src/
path/src
And I have tried
git ls-files -s | gawk '/120000/{print $4}'
git update-index path/src/ --assume-unchanged
but I still get:
error: readlink("path/src"): Function not implemented
error: unable to index file path/src
fatal: updating files failed
I have tried all these other suggestions. And even this doesn't work.
Any ideas?
Upvotes: 17
Views: 6802
Reputation: 4281
Here are my steps for this issue, similar, but a bit different from other answers.
Let's say I had a folder .fvm
contain file.json
and flutter_sdk(link)
that all commited in git before, then I want to ignore out flutter_sdk
.
.fvm/flutter_sdk
and .fvm/flutter_sdk/
in .gitignore
..fvm/flutter_sdk
out to other place than the repository.git add .
and git commit ....
Upvotes: 1
Reputation: 771
I know this is late, but I ran into this issue.
In my case, I apparently had checked in my symlink at some point. So no matter what I did, .gitignore
would not work (I think that is what Alexandre was getting at).
REPAIR:
Now you can re-add your symlinks and .gitignore
should work.
Upvotes: 3
Reputation: 5969
You can do a checkout ignoring this single file like this:
git checkout HEAD . --no path/src
The .gitignore
file only works for adding stuff to the index. Even a modifications on files commited before adding it to the .gitignore
are not ignored.
Upvotes: 3