Issue
my OS is Ubuntu 20.04
I Have gone through this post How to add chmod permissions to file in GIT?
What I have is this file https://github.com/PRATAP-KUMAR/focalgdm3/blob/master/focalgdm3
What am I looking is to
chmod +x
such that once I download the file by this link wget https://raw.githubusercontent.com/PRATAP-KUMAR/focalgdm3/master/focalgdm3 from github it is ready to be executed in Ubuntu 20.04
I tried git update-index
command but got error..
pratap@i7-6550U:~$ git update-index --chmod=+x focalgdm3fatal: not a git repository (or any of the parent directories): .gitpratap@i7-6550U:~$
looking for a step by step procedure..
Solution
I have added the file to github by dragging the file from my computer to github upload existing file page.
Then clone the repository, and locally:
cd /path/to/local/clone
git add --chmod=+x myFile
git config --global user.name "My name"
git config --global user.email "[email protected]" (the one used for GitHub account)
git commit -m "Made myFile executable"
git push
As explained in Antwane's answer, a wget through HTTP won't work.
But as seen from "Download executable script from GitHub preserving +x permissions", you can:
- get the tarball from the GitHub repository (no need for Git)
- extract the single file from it: its permission should then be preserved.
That is:
wget -qO - https://github.com/<user>/repo>/archive/master.tar.gz | \
tar zx --strip-components=1 <repo>-master/<filename>
Replace <user>
with your GitHub username, <repo>
with your repository name
In your case:
wget -qO - https://github.com/PRATAP-KUMAR/focalgdm3/archive/master.tar.gz | \
tar zx --strip-components=1 focalgdm3-master/focalgdm3
Answered By - VonC Answer Checked By - Cary Denson (WPSolving Admin)