LoginSignup
5
2

More than 1 year has passed since last update.

Githubとの接続でremote errorがでる

Last updated at Posted at 2022-03-22

起きたこと

git fetchしようとしたら怒られた

$ git fetch
fatal: remote error: 
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.

原因

エラーメッセージに書いてあるページに書いてあるとおり、暗号化されていないgitプロトコルが廃止されたため。

リモートURLがgitプロトコルになっていた

$ git remote -v
origin	git://github.com/hoge-dev/hoge.git (fetch)
origin	git://github.com/hoge-dev/hoge.git (push)

2022/03/15より永続的に廃止となったようなので、今回の怒られが発生した模様。

対策

Pullしかしていない運用で鍵の登録がめんどくさかったので、プロトコルをhttpsにして対応

$ git remote set-url origin https://github.com/hoge-dev/hoge.git
$ git remote -v
origin	https://github.com/hoge-dev/hoge.git (fetch)
origin	https://github.com/hoge-dev/hoge.git (push)

めでたし、めでたし。

※鍵が登録済みでPushもするならプロトコルはsshでいい

$ git remote set-url origin git@github.com:hoge-dev/hoge.git
5
2
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
5
2