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?

More than 3 years have passed since last update.

Windows + Git + https接続で複数リポジトリ対応方法

Posted at

環境

・OS:Windows10Pro

背景

httpsでcloneした際に「fatal: repository 'xxx' not found」というエラーが発生。リポジトリはあるので、改めてローカルの設定を確認して対応した際のメモ。
gitの認証情報回りは、PC変えたりすると毎回調べてたりするので、備忘の為メモ

確認

現状、どのような構成になっているか確認してみる。

c:\temp>git config -l --system
http.sslbackend=openssl
http.sslcainfo=C:/tools/Git/mingw64/ssl/certs/ca-bundle.crt
credential.helper=manager

c:\temp>git config -l --global
user.name=xxx
user.email=xxx.com
credential.https://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/xxx.helper=manager
credential.https://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/xxx.username=xxx

c:\temp>git config -l --local
fatal: --local can only be used inside a git repository

どうやら、別のリポジトリの認証情報が邪魔している模様。

解決方法

git config globalの設定に下記追加
gitconfig globalの設定ファイル: c:\Users[ユーザー].gitconfig

[credential "%リポジトリURL%"]
	helper = manager
	username = %ユーザー名%
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?