There are 2 machines, A and B. And there are 2 branches, p16 and c2.
A has an ext3 filesystem, but on B the archive lives on a truecrypt drive with vfat, mount shows rw,uid=1000,gid=1000,umask=077
A has linked the directory tree of B into its directory tree using sshfs and then A pushed into B's p16 using the filesystem.
Now there are some permission problems:
B$ git status
# On branch p16
nothing to commit (working directory clean)
B$ git checkout c2
Switched to branch 'c2'
B$ git checkout p16
error: You have local changes to 'help.txt'; cannot switch branches.
git diff shows me a changed mode for all files now:
B$git diff
diff --git a/help.txtt b/help.txt
old mode 100644
new mode 100755
diff --git a/169.txt b/169.txt
old mode 100644
new mode 100755
...
(a list with all files having their mode changed follows)
...
I guess the problem is that the local filesystem is a vfat truecrypt container and the filesystem does not allow the permissions that the other machine expects.
Any ideas how I can better link the 2 machines with different filesystems?
These changes mean that metadata about your file changed, however the content of your file did not. If you're working in a group, this may start to intefere with pushes or just add noise to your commits.
Your file is already staged to be committed. You can show it's diff using the --cached option of git. To unstage it, just do what git status suggests in it's output ;) You can check The Git Index For more info.
The main difference between the commands is that git diff is specially aimed at comparisons, and it's very powerful at that: It can compare commits, branches, a single file across revisions or branches, etc. On the other hand, git status is specifically for the status of the working tree.
Indeed, coming from a nice Unix heritage, Git uses the mode 100644 to represent a non-executable file and 100755 to represent an executable file.
Such problems using git can occur, if the file permissions of the operating system are not functioning as they should in that location. For example, when foreign filesystems are mounted.
The solution was pointed out by meagar in his comment on the question above:
Just make sure you have (within the [core]
section) a line
filemode=false
in .git/config which will tell git to ignore the executable bit for files it's tracking.
Another way of doing the same thing would be to go to the root directory of the git repo in the terminal and type:
git config core.filemode false
Note that changing this setting is occasionally necessary, but otherwise it is better to keep the default behaviour. It's important in many cases for git to track file permissions correctly, so your project can work as it should.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With