1 Star 0 Fork 289

LiNick01 / esp-idf

forked from 乐鑫开源 / esp-idf 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
set-submodules-to-github.sh 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env bash
#
# Explicitly switches the relative submodules locations on GitHub to the original public URLs
#
# '../../group/repo.git' to 'https://github.com/group/repo.git'
#
# This can be useful for non-GitHub forks to automate getting of right submodules sources.
#
#
# It makes sense to do
#
# git submodule deinit --force .
# git submodule init
#
# before running this, and
#
# git submodule update --recursive
#
# after that. These were not included over this script deliberately, to use the script flexibly
#
set -o errexit
set -o pipefail
set -o nounset
DEBUG_SHELL=${DEBUG_SHELL:-"0"}
[ "${DEBUG_SHELL}" = "1" ] && set -x
### '../../' relative locations
for LINE in $(git config -f .gitmodules --list | grep "\.url=../../[^.]")
do
SUBPATH=$(echo "${LINE}" | sed "s|^submodule\.\([^.]*\)\.url.*$|\1|")
LOCATION=$(echo "${LINE}" | sed 's|.*\.url=\.\./\.\./\(.*\)$|\1|')
SUBURL="https://github.com/$LOCATION"
git config submodule."${SUBPATH}".url "${SUBURL}"
done
git config --get-regexp '^submodule\..*\.url$'
C
1
https://gitee.com/qinchwuhuai/esp-idf.git
git@gitee.com:qinchwuhuai/esp-idf.git
qinchwuhuai
esp-idf
esp-idf
master

搜索帮助