ページの作成
親となるページを選択してください。
親ページに紐づくページを子ページといいます。
例: 親=スポーツ, 子1=サッカー, 子2=野球
子ページを親ページとして更に子ページを作成することも可能です。
例: 親=サッカー, 子=サッカーのルール
親ページはいつでも変更することが可能なのでとりあえず作ってみましょう!
| この記事の要点 |
|---|
|
エラーの状況
$ git push origin main
Username for 'https://github.com': myuser
Password for 'https://myuser@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/.../switching-remote-urls
fatal: Authentication failed for 'https://github.com/user/repo.git/'
# または
remote: HTTP Basic: Access denied
fatal: 認証に失敗しました。再試行してください。
原因
GitHub: 2021-08-13 以降、HTTPS 経由の git 操作でパスワード認証が完全廃止。Personal Access Token (PAT) または SSH 鍵を使う必要があります。
GitLab / Bitbucket: 同様に PAT / SSH 推奨。
対処方法 1: Personal Access Token (PAT)
GitHub の場合
- GitHub にログイン → Settings → Developer settings
- Personal access tokens → Tokens (classic) → Generate new token
- Note: トークンの用途を入力(例: "my-laptop")
- Expiration: 有効期限(30日 / 90日 / なし)
- Scopes: 必要な権限にチェック
- privateリポジトリ操作 → repo
- workflow → workflow
- Generate token → 表示されたトークンをコピー(再表示不可)
使い方
$ git push origin main
Username for 'https://github.com': myuser
Password for 'https://myuser@github.com': [PAT をペースト]
# → 成功
# 毎回入力するのは面倒 → キャッシュ
$ git config --global credential.helper cache
$ git config --global credential.helper "cache --timeout=3600" # 1 時間
# macOS Keychain (推奨)
$ git config --global credential.helper osxkeychain
# Windows Credential Manager
$ git config --global credential.helper manager
# Linux
$ git config --global credential.helper store # 平文保存、注意
$ git config --global credential.helper cache # メモリ、安全
対処方法 2: SSH 鍵認証(推奨)
① SSH 鍵生成
# Ed25519 (推奨)
$ ssh-keygen -t ed25519 -C "your@email.com"
# 場所: ~/.ssh/id_ed25519 (秘密鍵) と id_ed25519.pub (公開鍵)
# パスフレーズは設定推奨
# 公開鍵を表示
$ cat ~/.ssh/id_ed25519.pub
ssh-ed25519 AAAA... your@email.com
② 公開鍵を Git ホスティングサービスに登録
- GitHub: Settings → SSH and GPG keys → New SSH key
- GitLab: User Settings → SSH Keys
- Bitbucket: Personal settings → SSH keys
③ リモート URL を SSH に変更
# 現在の URL 確認
$ git remote -v
origin https://github.com/user/repo.git (fetch)
origin https://github.com/user/repo.git (push)
# SSH に変更
$ git remote set-url origin git@github.com:user/repo.git
# 確認
$ git remote -v
origin git@github.com:user/repo.git (fetch)
# 接続テスト
$ ssh -T git@github.com
Hi user! You've successfully authenticated...
キャッシュされた認証情報の削除
# macOS Keychain
# キーチェーンアクセス.app → "github.com" を検索 → 削除
# Windows Credential Manager
# コントロールパネル → 資格情報マネージャー → "git:..." を削除
# Linux (file ベース)
$ rm ~/.git-credentials
# キャッシュタイムアウト
$ git config --global credential.helper "cache --timeout=0" # 即削除
HTTPS URL に PAT を埋め込む(非推奨)
# 一時的にトークンを URL に
$ git clone https://USER:PAT@github.com/user/repo.git
# .git/config に保存される (PAT が平文で残る)
$ cat .git/config
[remote "origin"]
url = https://USER:PAT@github.com/user/repo.git
# セキュリティリスクあり、credential.helper の方が安全
SSH 鍵で複数アカウント使い分け
# 個人用と仕事用で別の SSH 鍵
$ ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_personal
$ ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_work
# ~/.ssh/config
Host github.com-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_personal
Host github.com-work
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_work
# リポジトリ URL を分岐
$ git clone git@github.com-personal:myuser/my-repo.git
$ git clone git@github.com-work:company/work-repo.git
2 要素認証 (2FA) との関係
2FA を有効にしていても影響なし。むしろ:
- HTTPS: PAT 必須(2FA 有無に関わらず password 直接は不可)
- SSH: 公開鍵認証、2FA の影響なし
credential.helper オプション
| helper | 動作 | OS |
|---|---|---|
cache | メモリに一定時間保持 | 全 OS |
store | 平文ファイル保存 | 全 OS (非推奨) |
osxkeychain | macOS Keychain | macOS |
manager | Credential Manager | Windows |
libsecret | GNOME Keyring | Linux |
関連エラー
Authentication failed: このページPermission denied (publickey): SSH 鍵が登録されていない / 認識されていないHost key verification failed: known_hosts に登録されていない(初回接続)fatal: unable to access: プロキシ / DNS / ファイアウォールSSL certificate problem: 証明書エラー
関連記事
ページの作成
親となるページを選択してください。
親ページに紐づくページを子ページといいます。
例: 親=スポーツ, 子1=サッカー, 子2=野球
子ページを親ページとして更に子ページを作成することも可能です。
例: 親=サッカー, 子=サッカーのルール
親ページはいつでも変更することが可能なのでとりあえず作ってみましょう!
子ページ
子ページはありません
同階層のページ
- SSH2秘密鍵の読み込みに失敗しました
- 認証に失敗しました。再試行してください。
人気ページ
- 1 Eclipseで「サーバーに追加または除去できるリソースがありません。」の原因と対処法
- 2 tomcat の起動 / 停止ログと catalina.log・catalina.out の違い
- 3 JavaScript base URL 取得方法|window.location.origin と SSR/Node.js 対応
- 4 YouTube Data API v3 エラー一覧|403/400/404 の主要原因と切り分け
- 5 Spring Frameworkのアノテーション一覧
- 6 Laravel エラー一覧|500/Blade/DB 接続/ルーティングの代表エラー
- 7 3Dグラフィックスとは|モデリング/レンダリング/主要ソフトウェア (Blender / Maya)
- 8 【Spring】@Valueアノテーションとは
- 9 CATALINA_HOME の確認方法 (Linux / Mac)
- 10 【Spring】@Autowiredアノテーションとは
最近更新/作成されたページ
- Laravel キャッシュクリア完全ガイド(cache:clear / config:clear / 2026-05-18 07:42:07
- プロジェクトの作成と削除 2026-05-18 07:42:07
- インストール直後にNetbeansが反応しない 2026-05-18 07:42:07
- 動画やチャンネルの検索 2026-05-18 07:42:07
- APIキー取得方法 2026-05-18 07:42:07
- チャンネル情報の取得 2026-05-18 07:42:07
- API 入門 — Web API(REST / GraphQL / gRPC / 2026-05-18 07:42:07
- インストール(eclipseプラグイン) 2026-05-18 07:42:07
- Laravel「Dotenv values containing spaces must be surrounded 2026-05-18 07:42:07
- エラー一覧 2026-05-18 07:42:07
- curl: (51) SSL: certificate subject name '~' does not match 2026-05-18 07:42:07
- インストール方法(Windows版) 2026-05-18 07:42:07
- JSONから配列に変換 2026-05-18 07:42:07
- 処理を一定時間待つ 2026-05-18 07:42:07
- A non well formed numeric value encountered 2026-05-18 07:42:07
コメントを削除してもよろしいでしょうか?