feat(git): a CodeCommit SSH key ID is saved for every region; a clone tries each saved account

Settings → Git → AWS CodeCommit asks for the key ID only: the default key's
login is written for every CodeCommit region at once (allRegions), shown as
one row, with Use in every region for an older one-region save. A clone of
a CodeCommit URL with no user tries every saved CodeCommit login — the
region's own first, then other regions' and each named key's — so a second
AWS account clones from the plain AWS URL with no ssh://<alias>/ rewrite.
This commit is contained in:
2026-11-02 10:32:20 +07:00
parent 6511e4ec62
commit 0c964909e0
10 changed files with 364 additions and 128 deletions
+20 -5
View File
@@ -3231,11 +3231,23 @@ export const api = {
* the user): for the host itself, or with `alias` one more account on it
* (`ssh://<alias>/…`); `key` = the only key it uses.
*/
setSshUser: (body: { host: string; user: string; alias?: string; key?: string }) =>
request<GitIdentity>("/me/git/ssh-user", { method: "PUT", body: JSON.stringify(body) }),
/** DELETE a login by its host (the host's own rule) or its alias. */
removeSshUser: (from: string) =>
request<GitIdentity>(`/me/git/ssh-user/${encodeURIComponent(from)}`, { method: "DELETE" }),
/** `allRegions`: AWS CodeCommit's default login, for every region at once. */
setSshUser: (body: {
host: string;
user: string;
alias?: string;
key?: string;
allRegions?: boolean;
}) => request<GitIdentity>("/me/git/ssh-user", { method: "PUT", body: JSON.stringify(body) }),
/** DELETE a login by its host (the host's own rule) or its alias;
* `allRegions` (a CodeCommit host): every region's login of `user`. */
removeSshUser: (from: string, opts?: { allRegions: true; user: string }) =>
request<GitIdentity>(
`/me/git/ssh-user/${encodeURIComponent(from)}${
opts ? `?allRegions=1&user=${encodeURIComponent(opts.user)}` : ""
}`,
{ method: "DELETE" }
),
saveHttps: (body: { host: string; username: string; password: string }) =>
request<GitIdentity>("/me/git/https", { method: "POST", body: JSON.stringify(body) }),
removeHttps: (host: string) =>
@@ -4945,6 +4957,9 @@ export interface GitIdentity {
* it uses, null = every key. Absent from an older server.
*/
sshUsers?: { host: string; user: string; alias?: string | null; key?: string | null }[];
/** The regions a CodeCommit key ID saved for every region covers. Absent
* from an older server. */
codecommitRegions?: string[];
/** The account's commit author (`git config --global`); null fields = unset. */
author: { name: string | null; email: string | null };
/** The suggested email while none is set: `<username>@smartgift.vn`. */