早就知道 Github CLI 但一直没用过。平时 SSH 能用就一直凑合用,今天想创个新仓库,又不想点开clash(2023-3-6 23:10:20 最近风声紧),想试试安装 Github CLI,在不科学情况下能不能用(答案:能用)
我打算在树莓派上面装,打算把它打造成一个工作站。CLI 官方推荐的 pi OS 的安装方式。参考
# 安装 type -p curl >/dev/null || sudo apt install curl -y curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ && sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ && sudo apt update \ && sudo apt install gh -y # 更新 sudo apt update sudo apt install gh
接着CLI登录,git 方式选 SSH (这里还是得先登上去)
pi@pi:~ $ gh auth login ? What account do you want to log into? GitHub.com ? What is your preferred protocol for Git operations? SSH ? Generate a new SSH key to add to your GitHub account? No ? How would you like to authenticate GitHub CLI? Paste an authentication token Tip: you can generate a Personal Access Token here https://github.com/settings/tokens The minimum required scopes are 'repo', 'read:org'. ? Paste your authentication token: **************************************** - gh config set -h github.com git_protocol ssh ✓ Configured git protocol ✓ Logged in as jneeee
下面记一些常用命令
gh repo create encoredev_go --private git remote add gh [email protected]:jneeee/encoredev_go.git git push gh
