While it is possible to use the personal access token in the URL like that, it's discouraged because (a) it stores your token in plaintext where it can be read and printed and (b) because it means you have to enter it for each repository.
It's better to use a credential manager to store your credentials by setting credential.helper
to an appropriate value for your platform, and then entering your username when prompted and your token as the password. That will save your credentials for future use across all your projects. If you need to use multiple accounts, just use your username (but not your token) in the URL, and the credential manager will handle that.
The default credential managers you want to use on most platforms are manager
or wincred
on Windows, osxkeychain
on macOS, and libsecret
on Linux. You can also use store
to store in a file on your local disk, which is available on all platforms, but less secure.
Once you've cloned the repository, you can just push with git push origin master
, since the URL you've cloned from will be set to the remote origin
.