mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge pull request #1219 from Dokploy/706-ability-to-use-a-custom-port-for-git
fix: set extracted port on ssh connection
This commit is contained in:
commit
13551f6065
@ -69,6 +69,7 @@ export const cloneGitRepository = async (
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { port } = sanitizeRepoPathSSH(customGitUrl);
|
||||||
await spawnAsync(
|
await spawnAsync(
|
||||||
"git",
|
"git",
|
||||||
[
|
[
|
||||||
@ -91,7 +92,7 @@ export const cloneGitRepository = async (
|
|||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
...(customGitSSHKeyId && {
|
...(customGitSSHKeyId && {
|
||||||
GIT_SSH_COMMAND: `ssh -i ${temporalKeyPath} -o UserKnownHostsFile=${knownHostsPath}`,
|
GIT_SSH_COMMAND: `ssh -i ${temporalKeyPath}${port ? ` -p ${port}` : ""} -o UserKnownHostsFile=${knownHostsPath}`,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -168,7 +169,8 @@ export const getCustomGitCloneCommand = async (
|
|||||||
);
|
);
|
||||||
if (customGitSSHKeyId) {
|
if (customGitSSHKeyId) {
|
||||||
const sshKey = await findSSHKeyById(customGitSSHKeyId);
|
const sshKey = await findSSHKeyById(customGitSSHKeyId);
|
||||||
const gitSshCommand = `ssh -i /tmp/id_rsa -o UserKnownHostsFile=${knownHostsPath}`;
|
const { port } = sanitizeRepoPathSSH(customGitUrl);
|
||||||
|
const gitSshCommand = `ssh -i /tmp/id_rsa${port ? ` -p ${port}` : ""} -o UserKnownHostsFile=${knownHostsPath}`;
|
||||||
command.push(
|
command.push(
|
||||||
`
|
`
|
||||||
echo "${sshKey.privateKey}" > /tmp/id_rsa
|
echo "${sshKey.privateKey}" > /tmp/id_rsa
|
||||||
@ -304,6 +306,7 @@ export const cloneGitRawRepository = async (entity: {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { port } = sanitizeRepoPathSSH(customGitUrl);
|
||||||
await spawnAsync(
|
await spawnAsync(
|
||||||
"git",
|
"git",
|
||||||
[
|
[
|
||||||
@ -322,7 +325,7 @@ export const cloneGitRawRepository = async (entity: {
|
|||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
...(customGitSSHKeyId && {
|
...(customGitSSHKeyId && {
|
||||||
GIT_SSH_COMMAND: `ssh -i ${temporalKeyPath} -o UserKnownHostsFile=${knownHostsPath}`,
|
GIT_SSH_COMMAND: `ssh -i ${temporalKeyPath}${port ? ` -p ${port}` : ""} -o UserKnownHostsFile=${knownHostsPath}`,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -381,7 +384,8 @@ export const cloneRawGitRepositoryRemote = async (compose: Compose) => {
|
|||||||
command.push(`mkdir -p ${outputPath};`);
|
command.push(`mkdir -p ${outputPath};`);
|
||||||
if (customGitSSHKeyId) {
|
if (customGitSSHKeyId) {
|
||||||
const sshKey = await findSSHKeyById(customGitSSHKeyId);
|
const sshKey = await findSSHKeyById(customGitSSHKeyId);
|
||||||
const gitSshCommand = `ssh -i /tmp/id_rsa -o UserKnownHostsFile=${knownHostsPath}`;
|
const { port } = sanitizeRepoPathSSH(customGitUrl);
|
||||||
|
const gitSshCommand = `ssh -i /tmp/id_rsa${port ? ` -p ${port}` : ""} -o UserKnownHostsFile=${knownHostsPath}`;
|
||||||
command.push(
|
command.push(
|
||||||
`
|
`
|
||||||
echo "${sshKey.privateKey}" > /tmp/id_rsa
|
echo "${sshKey.privateKey}" > /tmp/id_rsa
|
||||||
|
Loading…
Reference in New Issue
Block a user