4 Commits

Author SHA1 Message Date
329f3abb6b in create SSH command with escaped empty string for passphrase
Make sure there is "" visible in the ouput
2025-11-11 13:03:21 +09:00
495879207c Fix SSH PEM key setup script
Remove ":" from host name
Prepare proper host name without user
Set user from hostname part
Add command for vim to edit ssh config
2025-11-11 12:58:57 +09:00
6048c11791 Readme update 2025-09-11 18:00:48 +09:00
4d0a684ac6 Base setup update with ssh config create script 2025-09-11 17:57:51 +09:00
3 changed files with 17 additions and 5 deletions

View File

@@ -37,9 +37,12 @@ Planned to get auto fixes for wrong ACL, etc or missing config settings
A SSH Key has to be generated for each git respository that will be synced and the configuration has to be added to the ssh config file
```sh
create_ssh_config.sh [SSH Key name] [repo url full] ([jump proxy])
create_ssh_config.sh [repo url full] ([jump proxy])
```
> [!notice]
> This will currently output the command to create the SSH key and the host config to add to the ssh config file
### new_clone.sh
Create a new clone

View File

@@ -90,6 +90,7 @@ if [ -d "${GIT_WEBHOOK_BASE_FOLDER}" ]; then
"${BASE_FOLDER}init.sh" \
"${BASE_FOLDER}git_sync.sh" \
"${BASE_FOLDER}switch_branch.sh" \
"${BASE_FOLDER}create_ssh_config.sh" \
"${GIT_WEBHOOK_BASE_FOLDER}${CLONE_SCRIPTS_FOLDER}";
cp "${CONFIG_BASE}/webhook.default.cfg" \
"${GIT_WEBHOOK_BASE_FOLDER}${CONFIG_FOLDER}";
@@ -99,6 +100,7 @@ if [ -d "${GIT_WEBHOOK_BASE_FOLDER}" ]; then
"${BASE_FOLDER}init.sh" \
"${BASE_FOLDER}git_sync.sh" \
"${BASE_FOLDER}switch_branch.sh" \
"${BASE_FOLDER}create_ssh_config.sh" \
"${CONFIG_BASE}/webhook.default.cfg";
# check config entries missing
exit;
@@ -180,6 +182,7 @@ EOF
"${BASE_FOLDER}init.sh" \
"${BASE_FOLDER}git_sync.sh" \
"${BASE_FOLDER}switch_branch.sh" \
"${BASE_FOLDER}create_ssh_config.sh" \
"${GIT_WEBHOOK_BASE_FOLDER}${CLONE_SCRIPTS_FOLDER}";
cp \
"${CONFIG_BASE}/webhook.cfg" \
@@ -191,6 +194,7 @@ EOF
"${BASE_FOLDER}init.sh" \
"${BASE_FOLDER}git_sync.sh" \
"${BASE_FOLDER}switch_branch.sh" \
"${BASE_FOLDER}create_ssh_config.sh" \
"${CONFIG_BASE}/webhook.cfg" \
"${CONFIG_BASE}/webhook.default.cfg";
fi;

View File

@@ -28,7 +28,9 @@ if [ ! -f "${SSH_CONFIG_BASE}config" ]; then
fi;
if [[ "${REPOSITORY}" == *":"* ]]; then
REMOTE_HOST=$(echo "${REPOSITORY}" | cut -d ":" -f 1);
REMOTE_USER_HOST=$(echo "${REPOSITORY}" | cut -d ":" -f 1);
REMOTE_HOST=$(echo "${REMOTE_USER_HOST}" | cut -d "@" -f 2);
REMOTE_USER=$(echo "${REMOTE_USER_HOST}" | cut -d "@" -f 1);
else
echo "[!] Must set a full repository path with remote host for the repository";
error=1;
@@ -59,7 +61,8 @@ fi;
# SUDO_COMMAND= as base
# ssh-keygen -t ed25519 -N "" -C "${GIT_REPOSITORY_NAME}" -f "${SSH_CONFIG_BASE}${SSH_KEY_NAME}"
# must add ".pem" if key name does not end in .pem
SSH_COMMAND=("${SUDO_COMMAND[@]}" "ssh-keygen" "-t" "ed25519" "-N" "" "-C" "${GIT_REPOSITORY_NAME}" "-f" "${SSH_CONFIG_BASE}${GIT_REPOSITORY_NAME}.pem")
SSH_COMMAND=("${SUDO_COMMAND[@]}" "ssh-keygen" "-t" "ed25519" "-N" "\"\"" "-C" "${GIT_REPOSITORY_NAME}" "-f" "${SSH_CONFIG_BASE}${GIT_REPOSITORY_NAME}.pem")
SSH_CONFIG_COMMAND=("${SUDO_COMMAND[@]}" "vim" "${SSH_CONFIG_BASE}config")
# debug output for now
echo "";
@@ -69,9 +72,11 @@ echo "${SSH_COMMAND[*]}";
echo "";
echo "* ADD TO: ${SSH_CONFIG_BASE}config";
echo "";
echo "Host ${GIT_REPOSITORY_NAME}":
echo "${SSH_CONFIG_COMMAND[*]}";
echo "";
echo "Host ${GIT_REPOSITORY_NAME}"
echo " Hostname ${REMOTE_HOST}";
echo " User git";
echo " User ${REMOTE_USER}";
echo " PreferredAuthentications publickey";
echo " IdentityFile ~/.ssh/${GIT_REPOSITORY_NAME}.pem";
if [ -n "${JUMP_PROXY}" ]; then