I am developing on Windows and uploading to a Linux cloud server using git, via Bitbucket.
I edited a shell script, which on Windows has permissions
-rwxr-xr-x
For some reason, when it gets to Linux, it has permissions
-rw-r--r--
To make it executable I do:
chmod +x <my_script>.sh
Later, I edit the script back on Windows and push the changes up to Bitbucket. When I try to
git pull
back on the cloud I get the following error:
error: Your local changes to the following files would be overwritten by merge:
<path>/<my_script>.sh
Please commit your changes or stash them before you merge.
Aborting
All I did on the cloud was make the file executable. I didn't edit it! Can I tell git to get on with the merge and ignore file permissions? If not, how best to deal with this situation?
I realize I could unset the permissions
chmod -x <my_script>.sh
do the pull, and then reset the permissions
chmod +x <my_script>.sh
But to have to do this each time I edit is a pain. Is there a better way?
sh myscript.sh
instead