- fix git init

This commit is contained in:
Frogg 2026-05-15 19:31:42 +02:00
parent 166ec11114
commit 156f4b26f1
1 changed files with 5 additions and 4 deletions

View File

@ -23,12 +23,13 @@ getbranch(){
gitinit(){
local git_user git_email repo_name
local git_user git_email repo_name fold_name
# prepare vars
git_user="${1:-$CONFIG_GIT_USER}"
git_email="${2:-$CONFIG_GIT_EMAIL}"
repo_name="${3:-$CONFIG_GIT_SERVER}${git_user}/$(basename "$(pwd)").git"
fold_name=$(basename "$(pwd)")
repo_name="${3:-$CONFIG_GIT_SERVER}${git_user}/${fold_name}.git"
msg_info "Set git user : ${git_user} ${git_email}"
git config --global --replace-all user.name "${git_user}"
@ -48,14 +49,14 @@ gitinit(){
-H \"accept: application/json\" \\
-H \"Authorization: token ${CONFIG_GIT_TOKEN_INIT}\" \\
-H \"Content-Type: application/json\" \\
-d \"{\\\"name\\\":\\\"frogg_ssl_check\\\", \\\"private\\\":true}\""
-d \"{\\\"name\\\":\\\"${fold_name}\\\", \\\"private\\\":true}\""
# Create repo on git server
if ! curl -f -s -X POST "${CONFIG_GIT_SERVER}api/v1/user/repos" \
-H "accept: application/json" \
-H "Authorization: token ${CONFIG_GIT_TOKEN_INIT}" \
-H "Content-Type: application/json" \
-d "{\"name\":\"frogg_ssl_check\", \"private\":true}"; then
-d "{\"name\":\"${fold_name}\", \"private\":true}"; then
msg_error "Error while creating new repository on ${CONFIG_GIT_SERVER}"
return 1