記事のバージョン: Enterprise Server 2.17
リモートを削除する
git remote rm コマンドを使用して、リポジトリからリモート URL を削除します。
git remote rm コマンドは 1 つの引数を取ります:
- リモート名 (destinationなど)
サンプル
次の例は (推奨されるとおり) HTTPS を使用してクローンを作成したと想定しています。
$ git remote -v
# 現在のリモートの表示
> origin  https://hostname/オーナー/リポジトリ.git (fetch)
> origin  https://hostname/オーナー/リポジトリ.git (push)
> destination  https://hostname/フォーカー/リポジトリ.git (fetch)
> destination  https://hostname/フォーカー/リポジトリ.git (push)
$ git remote rm destination
# リモートの削除
$ git remote -v
# 削除されていることの検証
> origin  https://hostname/オーナー/リポジトリ.git (fetch)
> origin  https://hostname/オーナー/リポジトリ.git (push)メモ: git remote rm はリモートリポジトリをサーバから削除するわけではありません。  リモートとその参照をローカルリポジトリから削除するだけです。
トラブルシューティング
リモートを削除しようとすると、次のエラーが発生することがあります。
Could not remove config section 'remote.[name]'
このエラーは、削除しようとしたリモートが存在しないことを意味します。
$ git remote rm sofake
> error: Could not remove config section 'remote.sofake'リモート名を正しく入力したか確認してください。