You should do
git remote add origin https://<access-token-name>:<access-token>@gitlab.com/myuser/myrepo.git
Note that this stores the access token as plain text in the .gitconfig
file. To avoid this you can use the git credential system, providing the access token name for "username" and the access token for "password". This should store the credentials in the git credential system in a more secure way.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…