git-ftp icon indicating copy to clipboard operation
git-ftp copied to clipboard

set CHMOD of file after it has been uploaded

Open danielnieto opened this issue 8 years ago • 7 comments

Is there a way to change CHMOD permissions once a file has been uploaded? If this cannot be done as for now, can someone point me in the right direction how could I implement it myself? maybe with a hook?

danielnieto avatar Feb 21 '17 20:02 danielnieto

That is interesting. I'm guessing you are pushing from a file system that does not support permissions to one that does?

amayer5125 avatar Feb 23 '17 04:02 amayer5125

well, I have a small team deploying to FTP server (on Linux) we all work on Mac, and we had issues while deploying due to file permissions on FTP server (if another person created a new file and other wanted to upload a modified version of it), I thought this could be resolved if we could change the file permission once it has been uploaded to FTP server, but your answer got me thinking, and I just created a git hook to change file permissions to newly created files after a commit (to avoid messing with umask at system level) I think this approach while not being close to be the best solution will be sufficient for our needs, thank you for your response!

danielnieto avatar Feb 23 '17 06:02 danielnieto

Actually I just knew that the FTP server automatically changes the file permissions to 755 even if I upload one that is 777, and this is not something I can change on the server, so I think I will still need to change file permissions once they have been uploaded, is there a way to CHMOD a file everytime it gets uploaded?

danielnieto avatar Feb 23 '17 18:02 danielnieto

There seems to be a way to do that with curl: https://curl.haxx.se/mail/archive-2008-03/0061.html

But it's not supported by Git-ftp. You could write your own post-push-hook to change file permissions.

mkllnk avatar Feb 24 '17 01:02 mkllnk

Could this be marked as a feature request? It would be very helpful to be able to set default permissions in gitconfig per destination. Something like: chmod_d = 775 chmod_f = 664

swinggraphics avatar Mar 22 '17 15:03 swinggraphics

how hard would implementing @swinggraphics' idea be?

ethanbeyer avatar Feb 21 '19 20:02 ethanbeyer

Related issue: https://github.com/git-ftp/git-ftp/issues/379

iaeiou avatar Jul 19 '21 21:07 iaeiou