Skip to content

Instantly share code, notes, and snippets.

View qixiaobo's full-sized avatar
:octocat:
Coding

qixiaobo qixiaobo

:octocat:
Coding
View GitHub Profile
@qixiaobo
qixiaobo / changeRemoteUrl.sh
Created June 1, 2022 09:41 — forked from samirreza/changeRemoteUrl.sh
Shell script to bulk change git remote url
directoryContainingAllRepos="" # directory containing all git repo's
oldGitRemoteServer="" # current remote server url for example gitlab.com
newGitRemoteServer="" # new remote server url for example git.example.com
cd $directoryContainingAllRepos
find * -maxdepth 0 -type d \( ! -name . \) -print | while read dir
do
cd $dir
if [ -d ".git" ]
then
remoteUrl1="$(git config --get remote.origin.url)"