0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Git】【GitHub】アクセストークンの設定・更新方法

0
Last updated at Posted at 2026-07-16

はじめに

この記事では、GitHub認証に必要なアクセストークンの設定方法についてまとめます。
アクセストークンの期限が切れた際も同様の設定方法で更新が可能です。

1. アクセストークンを生成する

1. GitHubにてアクセストークン生成ページへ移動

GitHubの下記ページへ移動します。

Settings
 > Developer Settings
 > Personal access tokens
 > Tokens(classic)
 > Generate new token
 > Generate new token(classic)

2. アクセストークンの生成

上記のページにて、下記内容を入力し「Generate token」ボタンを押下します。

  • Note:概要を入力
  • Expiration:有効期限を選択
  • Select scopes:「repo」を選択

上記では一例として「repo」を選択しています。
用途に応じて適切なスコープを設定してください。

「Generate token」ボタンを押下後、生成されたアクセストークンを控えます。

アクセストークンの生成後、画面遷移を行うと生成されたトークンは参照できなくなります。

2. remote URLを設定・更新する

ローカルにて下記コマンドを実行し、remoteのURLを設定・更新します。

git remote set-url origin https://<ユーザ名>:<アクセストークン>@github.com/<ユーザ名>/<リポジトリ名>.git

現在設定されているremote URLの内容は下記で確認できます。

git remote get-url origin

または

git remote -v

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?