{{ctx.Locale.Tr "settings.applications"}}
diff --git a/templates/org/settings/ssh_keys.tmpl b/templates/org/settings/ssh_keys.tmpl
new file mode 100644
index 0000000000..461cb39851
--- /dev/null
+++ b/templates/org/settings/ssh_keys.tmpl
@@ -0,0 +1,46 @@
+{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings ssh-keys")}}
+
+
+
+{{template "org/settings/layout_footer" .}}
\ No newline at end of file
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index b61076ff46..70955e5f16 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -123,7 +123,11 @@
{{if $.PullMirror}}
{{ctx.Locale.Tr "repo.mirror_from"}}
-
{{$.PullMirror.RemoteAddress}}
+ {{if not (StringUtils.HasPrefix $.PullMirror.RemoteAddress "ssh://")}}
+
{{$.PullMirror.RemoteAddress}}
+ {{else}}
+
{{$.PullMirror.RemoteAddress}}
+ {{end}}
{{if $.PullMirror.UpdatedUnix}}{{ctx.Locale.Tr "repo.mirror_sync"}} {{DateUtils.TimeSince $.PullMirror.UpdatedUnix}}{{end}}
{{end}}
diff --git a/templates/repo/migrate/git.tmpl b/templates/repo/migrate/git.tmpl
index 41139d4fd6..4dd2aa0d92 100644
--- a/templates/repo/migrate/git.tmpl
+++ b/templates/repo/migrate/git.tmpl
@@ -18,6 +18,10 @@
{{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}}
+
+
{{ctx.Locale.Tr "repo.migrate.ssh_helper_title"}}: {{ctx.Locale.Tr "repo.migrate.ssh_helper_desc"}}
+ {{ctx.Locale.Tr "repo.migrate.ssh_helper_link"}}
+
diff --git a/templates/user/settings/keys.tmpl b/templates/user/settings/keys.tmpl
index e0f5e426ae..20597dd6f6 100644
--- a/templates/user/settings/keys.tmpl
+++ b/templates/user/settings/keys.tmpl
@@ -7,5 +7,7 @@
{{if not ($.UserDisabledFeatures.Contains "manage_gpg_keys")}}
{{template "user/settings/keys_gpg" .}}
{{end}}
+
+ {{template "user/settings/keys_mirror_ssh" .}}
{{template "user/settings/layout_footer" .}}
diff --git a/templates/user/settings/keys_mirror_ssh.tmpl b/templates/user/settings/keys_mirror_ssh.tmpl
new file mode 100644
index 0000000000..de787a3615
--- /dev/null
+++ b/templates/user/settings/keys_mirror_ssh.tmpl
@@ -0,0 +1,47 @@
+
+
+
diff --git a/web_src/js/features/repo-migrate.ts b/web_src/js/features/repo-migrate.ts
index 0788f83215..aae78a9741 100644
--- a/web_src/js/features/repo-migrate.ts
+++ b/web_src/js/features/repo-migrate.ts
@@ -59,3 +59,44 @@ async function doMigrationRetry(e: DOMEvent) {
await POST(e.target.getAttribute('data-migrating-task-retry-url'));
window.location.reload();
}
+
+export function initRepoMigrationForm() {
+ const cloneAddrInput = document.querySelector('#clone_addr');
+ const authUsernameInput = document.querySelector('#auth_username');
+ const authPasswordInput = document.querySelector('#auth_password');
+ const sshHelpText = document.querySelector('.help.ssh-help');
+
+ if (!cloneAddrInput || !authUsernameInput || !authPasswordInput || !sshHelpText) return;
+
+ function isSSHURL(url: string): boolean {
+ return url.startsWith('ssh://') ||
+ url.startsWith('git@') ||
+ (url.includes('@') && url.includes(':') && !url.includes('://'));
+ }
+
+ function updateAuthFields() {
+ const url = cloneAddrInput.value.trim();
+ const isSSH = isSSHURL(url);
+
+ if (isSSH) {
+ // Disable auth fields for SSH URLs
+ authUsernameInput.disabled = true;
+ authPasswordInput.disabled = true;
+ authUsernameInput.value = '';
+ authPasswordInput.value = '';
+ authUsernameInput.parentElement?.classList.add('disabled');
+ authPasswordInput.parentElement?.classList.add('disabled');
+ showElem(sshHelpText);
+ } else {
+ authUsernameInput.disabled = false;
+ authPasswordInput.disabled = false;
+ authUsernameInput.parentElement?.classList.remove('disabled');
+ authPasswordInput.parentElement?.classList.remove('disabled');
+ hideElem(sshHelpText);
+ }
+ }
+
+ updateAuthFields();
+ cloneAddrInput.addEventListener('input', updateAuthFields);
+ cloneAddrInput.addEventListener('blur', updateAuthFields);
+}
diff --git a/web_src/js/index.ts b/web_src/js/index.ts
index 7e84773bc1..06bc06da6e 100644
--- a/web_src/js/index.ts
+++ b/web_src/js/index.ts
@@ -29,7 +29,7 @@ import {initRepoCodeView} from './features/repo-code.ts';
import {initSshKeyFormParser} from './features/sshkey-helper.ts';
import {initUserSettings} from './features/user-settings.ts';
import {initRepoActivityTopAuthorsChart, initRepoArchiveLinks} from './features/repo-common.ts';
-import {initRepoMigrationStatusChecker} from './features/repo-migrate.ts';
+import {initRepoMigrationStatusChecker, initRepoMigrationForm} from './features/repo-migrate.ts';
import {initRepoDiffView} from './features/repo-diff.ts';
import {initOrgTeam} from './features/org-team.ts';
import {initUserAuthWebAuthn, initUserAuthWebAuthnRegister} from './features/user-auth-webauthn.ts';
@@ -135,6 +135,7 @@ onDomReady(() => {
initRepoIssueSidebarDependency,
initRepoMigration,
initRepoMigrationStatusChecker,
+ initRepoMigrationForm,
initRepoProject,
initRepoPullRequestAllowMaintainerEdit,
initRepoPullRequestReview,