気ままに気ままのエンジニアブログ

定期的に得た知見を気ままに発信中

【解消方法あり】The unauthenticated git protocol on port 9418 is no longer supported.は、GitリモートがSSHまたはgit://を介して接続しているユーザのみ影響ができるエラーだった

こんにちは。

久しぶりの更新です。

どうもハチマキです。

はじめに

以下事象が発生したため、解消に調査を行いました。その調査結果をまとめております。

事象

Travis CIで走る自動テストが急に通らなくなった

エラーログ

$ bundle install --deployment --without development production --jobs=4
The git source `git://github.com/〇〇/comfortable-mexican-sofa.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
The git source `git://github.com/eLocal/mobylette.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
The git source `git://github.com/esminc/seory.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
The git source `git://github.com/〇〇/〇〇.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
Fetching gem metadata from https://rubygems.org/.......
Fetching git://github.com/〇〇/comfortable-mexican-sofa.git
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.
・
・
・
has failed.

The command "eval bundle install --deployment --without development production --jobs=4 " failed 3 times.
The command "bundle install --deployment --without development production --jobs=4" failed and exited with 11 during .

Your build has been stopped.

検索内容

The unauthenticated git protocol on port 9418 is no longer supported.

原因/問題

SSHまたはgit://を介して接続していたため、影響があった
※これがヒットし、原因を特定できた
github.blog

解消方針

Gitプロトコルをgit://からhttps:// に置き換える
参考資料:
naari.hatenablog.com

手順

1. Gemfileに以下コードを追記する

git_source(:github) { |repo| "https://github.com/#{repo}.git" }

2. ターミナルで以下を実行する

$ bundle install --no-deploymentを実行する ※https:// に置き換わる

-  remote: git://github.com/eLocal/mobylette.git
+  remote: https://github.com/eLocal/mobylette.git
・
-  remote: git://github.com/esminc/seory.git
+  remote: https://github.com/esminc/seory.git
・
・

以上です。お疲れ様でした。