3 Star 3 Fork 0

热门极速下载/calendso

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
git-setup.sh 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
Hariom Balhara 提交于 2024-06-25 17:15 . Fix git-setup.sh (#15560)
#!/bin/sh
# If no project name is given
if [ $# -eq 0 ]; then
# Display usage and stop
echo "Usage: git-setup.sh <console,website,platform>"
exit 1
fi
# Get remote url to support either https or ssh
remote_url=$(echo $(git config --get remote.origin.url) | sed 's![^/]*$!!')
# Loop through the requested modules
for module in "$@"; do
echo "Setting up '$module' module..."
# Set the project git URL
project=$remote_url$module.git
# Check if we have access to the module
if [ "$(git ls-remote "$project" 2>/dev/null)" ]; then
echo "You have access to '${module}'"
# Create the .gitmodules file if it doesn't exist
([ -e ".gitmodules" ] || touch ".gitmodules") && [ ! -w ".gitmodules" ] && echo cannot write to .gitmodules && exit 1
# Prevents duplicate entries
git config -f .gitmodules --unset-all "submodule.apps/$module.branch"
# Add the submodule
git submodule add --force $project "apps/$module"
# Determine the branch based on module
branch="main"
if [ "$module" = "website" ]; then
branch="production"
fi
# Set the default branch
git config -f .gitmodules --add "submodule.apps/$module.branch" ${branch}
# Update to the latest of branch in that submodule
cd apps/$module && git pull origin ${branch} && cd ../..
# We forcefully added the subdmoule which was in .gitignore, so unstage it.
git restore --staged apps/$module
else
echo "You don't have access to: '${module}' module."
fi
done
git restore --staged .gitmodules
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_trending/calendso.git
git@gitee.com:mirrors_trending/calendso.git
mirrors_trending
calendso
calendso
main

搜索帮助