--- lang: ja-jp breaks: true --- # githubのリポジトリをコマンドラインで作成する Ubuntu 2021-05-02 ## GitHub CLI を使用する > cli/cli > https://github.com/cli/cli > https://github.com/cli/cli/releases > Installing gh on Linux and FreeBSD > https://github.com/cli/cli/blob/trunk/docs/install_linux.md #### GitHub CLI をインストール ```shell= $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 $ sudo apt-add-repository https://cli.github.com/packages $ sudo apt update $ sudo apt install gh ``` > GitHub CLI > https://cli.github.com/manual/ ##### 事前にgithubにログインして、Settings > Developer settings > Personal access tokens よりアクセストークンを取得しておく。 ※最低限、'repo'、'read:org'、'workflow' にはチェックしておく。 ```shell= $ gh auth login ? What account do you want to log into? GitHub.com ? What is your preferred protocol for Git operations? HTTPS ? Authenticate Git with your GitHub credentials? Yes ? 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', 'workflow'. ? Paste your authentication token: **************************************** - gh config set -h github.com git_protocol https ✓ Configured git protocol ✓ Logged in as xxxxxxxx ``` ##### リポジトリの作成 カレントフォルダ名をリポジトリ名として作成 ```shell= $ gh repo create `basename \`pwd\`` --confirm --description "" --private $ gh repo create `basename \`pwd\`` --confirm --description "" --public ``` ## ~/.gitconfig ファイルを使用した方法はうまくいかなかった。。 > Is it possible to create a remote repo on GitHub from the CLI without opening browser? > https://stackoverflow.com/questions/2423777/is-it-possible-to-create-a-remote-repo-on-github-from-the-cli-without-opening-br > コマンドラインでGitHubのリポジトリを公開もプライベートも作成する > https://2017.l2tp.org/archives/264 ###### tags: `git` `GitHub` `GitHub CLI` `Ubuntu`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up