2023-12-17 08:06:45 +03:00
|
|
|
|
if [ -z "$remote" ] || [ -z "$owner" ] || [ -z "$repo" ] || [ -z "$folder" ]; then
|
2023-12-17 07:53:27 +03:00
|
|
|
|
echo "Не указаны обязательные параметры." && exit 2
|
|
|
|
|
fi
|
|
|
|
|
echo "Создание локального репозитория, подключение к удалённому и передача данных."
|
2023-12-17 08:06:45 +03:00
|
|
|
|
seconds=3
|
2023-12-17 08:20:25 +03:00
|
|
|
|
currentTimeMillis=$(date '+%s%3N')
|
2023-12-17 07:53:27 +03:00
|
|
|
|
rm -rf .git
|
|
|
|
|
git init -b master
|
|
|
|
|
git remote add "$remote" "git@$remote:$owner/$repo.git"
|
|
|
|
|
git add .git*
|
2023-12-17 08:06:45 +03:00
|
|
|
|
git commit -m "Инициализация / $folder"
|
|
|
|
|
if [ "$remote" == "hub.mos.ru" ]; then
|
|
|
|
|
echo "Второй пуш, потому что лингвист с первого раза не срабатывает."
|
|
|
|
|
git push -u "$remote" master
|
|
|
|
|
echo "Ожидание $seconds с."
|
|
|
|
|
sleep $seconds
|
|
|
|
|
fi
|
2023-12-17 07:53:27 +03:00
|
|
|
|
git add CONTRIBUTING.md
|
2023-12-17 08:06:45 +03:00
|
|
|
|
git add \*LICENSE*
|
2023-12-17 07:53:27 +03:00
|
|
|
|
git commit -m "Открытая лицензия РФ"
|
2023-12-17 08:06:45 +03:00
|
|
|
|
git add DIRECTORY_TREE.md
|
|
|
|
|
git add WIKI.md
|
|
|
|
|
git add \*README*
|
2023-12-17 07:53:27 +03:00
|
|
|
|
git commit -m "Описание проекта"
|
2023-12-17 08:20:25 +03:00
|
|
|
|
git add \*.yml
|
|
|
|
|
git add \*Gemfile*
|
|
|
|
|
git add \*install.sh
|
|
|
|
|
git add \*.gemspec
|
|
|
|
|
git add \*robots.txt
|
|
|
|
|
git commit -m "Настройки"
|
2023-12-17 08:06:45 +03:00
|
|
|
|
git add \*.sh
|
2023-12-17 07:53:27 +03:00
|
|
|
|
git commit -m "Скрипты bash"
|
2023-12-17 08:06:45 +03:00
|
|
|
|
git add \*.min.css
|
|
|
|
|
git add \*.min.js
|
|
|
|
|
git add \*.woff
|
2023-12-17 07:53:27 +03:00
|
|
|
|
git commit -m "Сторонние материалы"
|
2023-12-17 08:06:45 +03:00
|
|
|
|
git add \*.bmp
|
|
|
|
|
git add \*.gif
|
|
|
|
|
git add \*.ico
|
|
|
|
|
git add \*.jpg
|
|
|
|
|
git add \*.png
|
|
|
|
|
git add \*.svg
|
2023-12-17 07:53:27 +03:00
|
|
|
|
git commit -m "Картинки"
|
2023-12-17 08:20:25 +03:00
|
|
|
|
find . -type f -not -path "*/.*" -not -path "./_site*" | sort -r | while read -r file; do
|
2023-12-17 07:53:27 +03:00
|
|
|
|
echo "Обработка: $file"
|
|
|
|
|
git add "$file"
|
|
|
|
|
git commit -m "${file#*/}"
|
|
|
|
|
done
|
|
|
|
|
git push -u "$remote" master
|
2023-12-17 08:20:25 +03:00
|
|
|
|
echo "Время создания локального репозитория: $(("$(date '+%s%3N')" - "$currentTimeMillis")) мс."
|