githubfile-permissionsgithub-release

Maintain executable file permissions when uploading binaries to a github release


I'm adding binaries to a release in github by dragging and dropping them into the binaries upload section when creating a new release. The binaries have the following permissions on my local (OSX):

-rwxr-xr-x 1 user group 100 Mar 22 00:00 file1 -rwxr-xr-x 1 user group 100 Mar 22 00:00 file2 -rwxr-xr-x 1 user group 100 Mar 22 00:00 file3 -rwxr-xr-x 1 user group 100 Mar 22 00:00 file4

However when I download the binary from Releases the file mode has changed:

-rw-r--r--@ 1 user group 100 Mar 22 09:00 file1

Has this been documented anywhere? Is there a way to preserve file permissions when uploading binaries to github?


Solution

  • Is there a way to preserve file permissions when uploading binaries to github?

    I don't believe so. People that download the file will need to chmod +x to get the execute permission back. A file's permission is not stored within the file itself, rather it is an attribute of the file on the file system.

    If you really need to preserve complex permissions for files, I would suggest storing the files in a container that preserve permissions. Like a DMG for macOS, and uploading the DMG instead.