1002Rename Branches on GitHub
Renaming a branch on Github is straight-forward:
![](https://codec.trembl.org/wp-content/uploads/2022/01/Screen-Shot-2022-01-11-at-15.00.55.jpg)
The "Lean More" link has some instructions how to update the local environments:
![](https://codec.trembl.org/wp-content/uploads/2022/01/Screen-Shot-2022-01-11-at-14.43.24.jpg)
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://trembl@github.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.
https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/
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.
![](https://codec.trembl.org/wp-content/uploads/2022/01/Screen-Shot-2022-01-11-at-14.44.59.jpg)
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