花1.png

使用gh实现云服务器下载GitHub私有release文件

概要:使用gh命令鉴权并拉取远程私有仓库,实现云服务器的release下载解压与部署

安装gh

ubuntu命令安装https://github.com/cli/cli/blob/trunk/docs/install_linux.md

sudo apt install gh
# 由于我们设置的私有仓库所以直接会报错我们需要设置token
>gh repo clone user/nuxt_test
To get started with GitHub CLI, please run:  gh auth login
Alternatively, populate the GH_TOKEN environment variable with a GitHub API authentication token.

授权:复制github的token

gh auth login

不需要安装依赖,直接进入项目执行命令下载release文件

gh repo clone user/nuxt_test
cd nuxt_test
gh release download v1.0.1

查看已经多了release文件

Created By @Seeyou | 稀有博客