0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

remote: Write access to repository not granted.が出た際の対処法

Posted at

はじめに

この記事は以下の記事を参考に作成した Linuxバージョンです.
https://qiita.com/hitomi2022/items/687d64cd44b2973a6eee

エラー内容

git pushを実行したら,以下のエラーが出た.

remote: Write access to repository not granted.
fatal: unable to access 'https://github.com/〇〇/××.git/': The requested URL returned error: 403

環境
OS: Linux
Git: 2.27.0

解決策

  1. SSHキーの作成

    ssh-keygen -t ed25519 -C "your_email@example.com"
    
    • passphraseを設定
    • 他は全てEnter
  2. SSHキーをssh-agentに登録

    $ eval "$(ssh-agent -s)"
    > Agent pid 59566
    
  3. configファイルの設定

    vim ~/.ssh/config
    
    • 以下の内容を書き込む
    Host github.com
      AddKeysToAgent yes
      IdentityFile ~/.ssh/id_ed25519
    
  4. GitHubにSSHキーを登録

    vim ~/.ssh/id_ed25519.pub
    
    • コピーしたキーを以下の手順に則り,貼り付ける.
      スクリーンショット 2024-07-12 15.24.59.png
  5. SSH接続ができているかチェック

    ssh -T git@github.com
    
    • 無事アクセスに成功した場合,以下の出力を得る.
      スクリーンショット 2024-07-12 15.26.35.png
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?