addet a setup script for git server agent
This commit is contained in:
parent
b95fa18b55
commit
95e122d05c
2 changed files with 64 additions and 0 deletions
3
fix.sh
Normal file
3
fix.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
sudo reflector --verbose --latest 10 --sort rate --save /etc/pacman.d/mirrorlist
|
61
setup/homelapGitSetup.sh
Normal file
61
setup/homelapGitSetup.sh
Normal file
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/env bash
|
||||
# ─< ANSI color codes >───────────────────────────────────────────────────────────────────
|
||||
RED='\033[0;31m'
|
||||
CYAN='\033[0;36m'
|
||||
YELLOW='\033[0;33m'
|
||||
LIGHT_GREEN='\033[0;92m'
|
||||
BOLD='\033[1m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo_error() {
|
||||
printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2
|
||||
}
|
||||
|
||||
echo_info() {
|
||||
printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1"
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1"
|
||||
}
|
||||
|
||||
echo_note() {
|
||||
printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1"
|
||||
}
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
gitUserSetup() {
|
||||
local g_username="server-agent"
|
||||
local g_mail="info@team-pieck.de"
|
||||
local g_branch="main"
|
||||
local g_domain="git.k4li.de"
|
||||
|
||||
local CREDENTIALS_FILE="$HOME/.git-credentials"
|
||||
|
||||
git config --global user.name "$g_username"
|
||||
git config --global user.email "$g_mail"
|
||||
git config --global init.defaultBranch "$g_branch"
|
||||
|
||||
echo_note "Enter your authentication token:"
|
||||
read -r -s g_token # The '-s' flag hides input for privacy
|
||||
|
||||
# Append the new credentials to the file
|
||||
echo "https://$g_username:$g_token@$g_domain" >>"$CREDENTIALS_FILE"
|
||||
|
||||
echo "Credentials added for $g_domain in $CREDENTIALS_FILE"
|
||||
|
||||
git config --global credential.helper store
|
||||
|
||||
chmod 600 "$HOME/.git-credentials"
|
||||
}
|
||||
|
||||
if ! command_exists git; then
|
||||
return 1
|
||||
echo_error "You don't have git installed!"
|
||||
fi
|
||||
|
||||
gitUserSetup
|
Loading…
Add table
Add a link
Reference in a new issue