LoginSignup
0
1

More than 5 years have passed since last update.

GitHubでSSH接続ができない時の対処法

Posted at

対処法

 今回は、ターミナルで以下のコマンドを実行することで、pushすることができるようになりました。一つの解決方法として、試してみてください。

 まず、以下のコマンドで現在の状況を確認します。今回は、ユーザ名をNAME、レポジトリ名をrepo/sosとします。

git remote -v

私の場合では、以下の状況でした。

origin  https://github.com/NAME/repo/sos.git (fetch)
origin  https://github.com/NAME/repo/sos.git (push)

本来ならば、以下のような出力を得られなければなりません。

origin  git@github.com:NAME/repo/sos.git (fetch)
origin  git@github.com:NAME/repo/sos.git (push)

よって、これから設定していきます。
ターミナルで以下のコマンドを入力するだけで完了です。

git remote set-url origin git@github.com:NAME/repo/sos.git

それでは確認してみましょう。

origin  git@github.com:NAME/repo/sos.git (fetch)
origin  git@github.com:NAME/repo/sos.git (push)

が出力されたら大丈夫です。
異なる出力が得られた場合は、入力したコマンドを確認してみましょう。

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