The reason I was getting this error was because Mac had stored an old keychain password and with my new login cridentials git was using the details of the keychain. So there was a clash
solution use terminal to delete keychain:
security delete-internet-password -s github.com
Restart mac then try to push from terminal
git push -u origin main
login with required cridentials