update git.sh
This commit is contained in:
parent
a3a8f0952d
commit
a4c4848524
1 changed files with 25 additions and 10 deletions
35
git.sh
35
git.sh
|
|
@ -1,14 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
echo "name for commit: "
|
echo "name for commit: "
|
||||||
read com
|
read com
|
||||||
git add .
|
git add .
|
||||||
git commit -m "$com"
|
git commit -m "$com"
|
||||||
git remote add gitflic git@gitflic.ru:hhu67/proj.git
|
declare -A remotes=(
|
||||||
git remote add github git@github.com:hhu67/my.git
|
["gitflic"]="git@gitflic.ru:hhu67/proj.git"
|
||||||
git remote add gitea git@gitek.duckdns.org:hhu67/my.git
|
["github"]="git@github.com:hhu67/my.git"
|
||||||
git remote add berg ssh://git@codeberg.org/hhu67/my.git
|
["gitea"]="git@gitek.duckdns.org:hhu67/my.git"
|
||||||
git remote add gitea.org git@gitea.com:hhu67/my.git
|
["berg"]="ssh://git@codeberg.org/hhu67/my.git"
|
||||||
git push gitflic main
|
["gitea.org"]="git@gitea.com:hhu67/my.git"
|
||||||
git push github main
|
)
|
||||||
git push gitea main
|
manage_remote() {
|
||||||
git push berg main
|
local name=$1
|
||||||
git push gitea.org main
|
local url=$2
|
||||||
|
|
||||||
|
if git remote | grep -q "^${name}$"; then
|
||||||
|
echo "Remote '$name' уже существует, пропускаю добавление."
|
||||||
|
else
|
||||||
|
echo "Добавляю remote: $name"
|
||||||
|
git remote add "$name" "$url"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
for name in "${!remotes[@]}"; do
|
||||||
|
manage_remote "$name" "${remotes[$name]}"
|
||||||
|
echo "Пушу в $name..."
|
||||||
|
git push "$name" main
|
||||||
|
done
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue