- fix git init
This commit is contained in:
parent
51f6fa3098
commit
a5e7b0b5b3
10
func/git.sh
10
func/git.sh
|
|
@ -33,9 +33,15 @@ gitinit(){
|
||||||
git commit -m "Initial commit"
|
git commit -m "Initial commit"
|
||||||
git branch -M main
|
git branch -M main
|
||||||
|
|
||||||
msg_info "Adding origin : ${3:-$CONFIG_GIT_SERVER$}$(basename "$(pwd)")"
|
msg_info "Adding origin : ${3:-$CONFIG_GIT_SERVER}$(basename "$(pwd)")"
|
||||||
git remote add origin "${3:-$CONFIG_GIT_SERVER}$(basename "$(pwd)")}"
|
git remote add origin "${3:-$CONFIG_GIT_SERVER}$(basename "$(pwd)")}"
|
||||||
|
|
||||||
|
msg_info "Try to create reposiroty on git server : curl -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}"
|
||||||
|
|
||||||
# Create repo on git server
|
# Create repo on git server
|
||||||
if ! curl -X POST "${CONFIG_GIT_SERVER}/api/v1/user/repos" \
|
if ! curl -X POST "${CONFIG_GIT_SERVER}/api/v1/user/repos" \
|
||||||
-H "accept: application/json" \
|
-H "accept: application/json" \
|
||||||
|
|
@ -49,7 +55,7 @@ gitinit(){
|
||||||
|
|
||||||
# Push repo on git server
|
# Push repo on git server
|
||||||
if ! git push -u origin main; then
|
if ! git push -u origin main; then
|
||||||
msg_error "Error while pushing to ${3:-$CONFIG_GIT_SERVER}$(basename "$(pwd)")}"
|
msg_error "Error while pushing to ${3:-$CONFIG_GIT_SERVER}$(basename "$(pwd)"}"
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue