[Git] Error: remote rejected (permission denied)
The error pop up When I pushed the changes on a new branch for the first time. ! [remote rejected] oscar-next -> oscar-next (permission denied) error: failed to push some refs to 'https://github.com/oscarzhou/portainer.git' The solution is to update the git config like below git config --local --list # old config remote.origin.url=https://github.com/oscarzhou/bar.git # update new config with git config remote.origin.url https://foo%40gmail.com@github.com/oscarzhou/bar.git After that, we can run git push --set-upstream origin <branch_name>