LoginSignup
0
0

More than 1 year has passed since last update.

同一ドメインで複数認証情報の対応方法

Posted at

背景

  • 複数のAWSアカウントのcodecommitを利用している
  • HTTPSでcodecommitのリポジトリにgitで接続する時に、事前に認証情報を保存しておくと、同じドメインで複数の認証情報を登録すると、以下のエラーが起こる
% git pull       
fatal: repository 'https://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/xxxxxxx/' not found 

対策1- Mac OS X のパスワード管理

  • パスワードの管理方式を設定する
git config --global credential.helper osxkeychain 
  • プロジェクトにgit設定
Cd path/to/project 

git config --local credential.https://git-codecommit.ap-northeast-1.amazonaws.com.username <YOUR USERNAME> 
  • git pull実施をして、パスワードを入力して正常に使える
% git pull  

Password for 'https://username@git-codecommit.ap-northeast-1.amazonaws.com':/v1/repos/xxxxxx/
  • パスワード保存場所
    • キーチェーンアクセスアプリ
    • ログイン -> gitで検索する
    • git-codecommit.ap-northeast-1.amazonaws.comを押す
    • Usernameとpasswordをみえる

対策2 - ファイルに保存

  • パスワードの管理方式を設定する
git config --global credential.helper store 
  • プロジェクトにgit設定
Cd path/to/project 

git config --local credential.https://git-codecommit.ap-northeast-1.amazonaws.com.username <YOUR USERNAME> 
  • git pull実施
% git pull  

Password for 'https://username@git-codecommit.ap-northeast-1.amazonaws.com':/v1/repos/xxxxxx/ 
  • パスワードを入力して正常に使える
  • ユーザネームとパスワード保存場所
    • ~/.git-credentials
  • デメリット
    • パスワードが平文が保存される
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