🤔 Situation
- changed remote repository url
- changed GitHub user name
👍 Solution for a few repositories
git remote -v
git remote set-url origin git@github.com:new_name/repository_name.git
git remote -v
🦄 Solution for many repositories
echo "git remote set-url origin git@"$(git remote -v | grep fetch | cut -d ' ' -f 1 | cut -d '@' -f 2 | sed -e 's/old_name/new_name/g') | bash
If remote -v
shows multiple remote repositories, i.e. origin, github, gitlab.., please adjust the grep command.
Top comments (0)