1002Rename Branches on GitHub
Renaming a branch on Github is straight-forward:
The "Lean More" link has some instructions how to update the local environments:
Your members will have to manually update their local environments. We'll let them know when they visit the repository, or you can share the following commands.
git branch -m oldbranchname newbranchname git fetch origin Username for 'https://github.com': trembl Password for 'https://email@example.com':
I tried automatically to log-in with my GitHub Password.
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token- authentication-requirements-for-git-operations/ for more information.
Get a Personal Access Token
Ok, we need a Personal Access Token instead of the password!
Go to github.com > Settings > Developer Settings > Personal access tokens, and generate a new token with full repo access.
Once we use the token instead of the password, it works.
git branch -u origin/main main # Branch 'main' set up to track remote branch 'main' from 'origin'.
git remote set-head origin -a # origin/HEAD set to main