I setup Two-factor authentication in my GitHub account. Then, I generated my personal access token in GitHub and used it in order to clone my private repository. However, it failed.
$ git config --get user.name
myusername
$ git clone https://github.com/xxx/MyPrivateProject.git
Cloning into 'MyPrivateProject'...
remote: Repository not found.
fatal: repository 'https://github.com/xxx/MyPrivateProject.git' not found
"myusername" has access permission and could exactly access to my private repository before two-factor authentication was setup.
Then, I tried following command and it worked well.
$ git config --get user.name
myusername
$ git clone https://myusername@github.com/xxx/MyPrivateProject.git
Cloning into 'MyPrivateProject'...
remote: Repository not found.
Cloning into 'ambie_co_jp'...
Password for 'https://myusername@github.com': <Personal Access Token>
remote: Enumerating objects: 475, done.
remote: Counting objects: 100% (475/475), done.
remote: Compressing objects: 100% (351/351), done.
remote: Total 475 (delta 96), reused 470 (delta 92), pack-reused 0
Receiving objects: 100% (475/475), 38.96 MiB | 5.06 MiB/s, done.
Resolving deltas: 100% (96/96), done.
I don't understand why I need to write "myusername@" in repository URL though "myusername" is already defined in .gitconfig as global user.
Could you give me any advice ??