Created
February 21, 2022 09:13
-
-
Save martian17/c47edf99b6956f1c5f13c6c54f63c43d to your computer and use it in GitHub Desktop.
Pull a git module with sub modules without ssh permissions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# first extracting the repository name | |
rep_regex="\\/([^\\/]*)\\.git$" | |
if [[ $1 =~ $rep_regex ]] | |
then | |
reponame="${BASH_REMATCH[1]}" | |
else | |
echo "$1 doesn't match" >&2 # this could get noisy if there are a lot of non-matching files | |
exit | |
fi | |
echo $reponame | |
rm -rf $reponame | |
git clone $1 | |
cd $reponame | |
ls | |
sed -E "s/git@([^\:]+):/https:\/\/\1\//g" .gitmodules > .gitmodules1 | |
mv .gitmodules1 .gitmodules | |
git submodule update --init --recursive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment