如何在github chmod = + x中制作上传的文件?然后使用wget命令下载文件,以保留github模式下的可执行文件集? [英] How to make a uploaded file in github chmod=+x? and then download the file with wget command preserving the executable set in github mode?

查看:107
本文介绍了如何在github chmod = + x中制作上传的文件?然后使用wget命令下载文件,以保留github模式下的可执行文件集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的操作系统是Ubuntu 20.04

my OS is Ubuntu 20.04

我已经看完这篇文章如何添加chmod权限要以GIT格式归档?

该文件的内容是 https://github.com/PRATAP-KUMAR/focalgdm3/blob/master/focalgdm3

我在寻找什么

chmod + x 这样,一旦我通过此链接下载文件,wget https://raw.githubusercontent.com/PRATAP-KUMAR/focalgdm3/master/focalgdm3 可以在github中执行Ubuntu 20.04

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

我尝试了 git update-index 命令,但遇到了错误。

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:~$ 

寻找逐步程序。.

推荐答案


I通过将文件从我的计算机拖到github上传现有文件页面,已将文件添加到github。

I have added the file to github by dragging the file from my computer to github upload existing file page.

然后克隆存储库,并在本地:

cd /path/to/local/clone
git add --chmod=+x myFile
git config --global user.name "My name"
git config --global user.email "my@email.com" (the one used for GitHub account)
git commit -m "Made myFile executable"
git push

Antwane answer ,通过HTTP的wget无法正常工作。

,但是从 从GitHub下载可执行脚本并保留+ x权限可见,您可以:

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:


  • 从GitHub存储库中获取tarball(无需Git)

  • 从其中提取单个文件:其权限应该保存。

即:

wget -qO - https://github.com/<user>/repo>/archive/master.tar.gz | \
tar zx --strip-components=1 <repo>-master/<filename>

< user> 替换为您的GitHub用户名< repo> 和您的存储库名称

Replace <user> with your GitHub username, <repo> with your repository name

在您的情况下:

wget -qO - https://github.com/PRATAP-KUMAR/focalgdm3/archive/master.tar.gz | \
tar zx --strip-components=1 focalgdm3-master/focalgdm3

这篇关于如何在github chmod = + x中制作上传的文件?然后使用wget命令下载文件,以保留github模式下的可执行文件集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆