Github personal access token issue

while pushing the code in github repository when asked for user name i entered the github personal access token of my account and for password i entered same token and it worked.

why so? shouldn’t it ask for user name?
is it correct behaviour for personal token to work as user name and password both

You’re right, the PAT should only replace the password, not the user name.

Maybe your Git’s credential manager was smart enough to realize that instead of a user you’ve inserted a PAT and just felt back on the previously stored user name instead?

The answer will be in your stored Git credentials, if you can open it you should find out which user name it’s associated with that PAT.