Change remote URL location of local repositories

When you have migrated your repositories from Bitbucket Cloud to Bitbucket Server and you need to adjust your local repositories do the following:

Windows

Download find and replace: http://findandreplace.io/download

# Change from Bitbucket Cloud to Bitbucket Server SSH:
"C:\Users\basvanbeek\Downloads\fnr\fnr.exe" --cl --dir "D:\PhpstormProjects" --fileMask "config" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find "ssh://git@bitbucket.org/" --replace "ssh://git@bitbucket.domein.nl:7999/"

# Change from Bitbucket Cloud to Bitbucket Server HTTP:
"C:\Users\basvanbeek\Downloads\fnr\fnr.exe" --cl --dir "D:\PhpstormProjects" --fileMask "config" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find "ssh://git@bitbucket.org/" --replace "https://bitbucket.domein.nl:7990/scm/"

# Optional: switch from HTTP to GIT:
"C:\Users\basvanbeek\Downloads\fnr\fnr.exe" --cl --dir "E:\PhpstormProjects" --fileMask "config" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find "https://bitbucket.domein.nl:7990/scm/" --replace "ssh://git@bitbucket.domein.nl:7999/"

Linux

cd /home/repos;
find ./ -maxdepth 3 -name 'config' -type f -print0 | xargs -0 sed -i 's/git\@bitbucket\.org:/ssh:\/\/git\@bitbucket\.domein\.nl:7999\//g'