HTTP(S) と SSH の両方で、ユーザー名は [email protected] の URL の一部として指定できます。 フォーム:
-
https://[email protected]/repo.git -
[email protected]:repo.git(はい、
[email protected]SSH ユーザー名は常にgitであることを意味します GitHub を使用する場合) -
ssh://[email protected]/repo.git
必要に応じて git remote set-url を使用してください または .git/config を直接編集します ファイル。
最も簡単な解決策:
git ルート ディレクトリから、構成ファイル .git/config を編集します。 .
次のようなセクションが表示されます:
[remote "origin"]
url = https://xxx.xxx/xxx/xxx.git
あなたがしたいことは、あなたの [email protected] を追加することです https:// の直後 .
[remote "origin"]
url = https://[email protected]/xxx/xxx.git
この構成ファイルを保存して閉じると、Git はそのリポジトリ内でユーザー名の入力を求めなくなります。