git.sh 794 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. echo "name for commit: "
  3. read com
  4. git add .
  5. git commit -m "$com"
  6. declare -A remotes=(
  7. ["gitflic"]="git@gitflic.ru:hhu67/proj.git"
  8. ["github"]="git@github.com:hhu67/my.git"
  9. ["forgejo"]="forgejo@git.vlv-s.site:hhu67/my.git"
  10. ["berg"]="ssh://git@codeberg.org/hhu67/my.git"
  11. ["gitea.org"]="git@gitea.com:hhu67/my.git"
  12. )
  13. manage_remote() {
  14. local name=$1
  15. local url=$2
  16. if git remote | grep -q "^${name}$"; then
  17. echo "Remote '$name' уже существует, пропускаю добавление."
  18. else
  19. echo "Добавляю remote: $name"
  20. git remote add "$name" "$url"
  21. fi
  22. }
  23. for name in "${!remotes[@]}"; do
  24. manage_remote "$name" "${remotes[$name]}"
  25. echo "Пушу в $name..."
  26. git push "$name" main
  27. done