A less desirable solution that I found is to edit the .git/config file and comment out the url under the '[remote "origin"]' with a '#', then, duplicate it and modify it to have the desired USER and TOKEN.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
# url = https://user1:[email protected]/user/repository.git
url = https://user2:[email protected]/user/repository.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
This way, it is possible to do a git push for example then go back and comment out the url that was added and uncomment the original one.
I am still looking for a more hassle free solution though, as this would leave both tokens in the .git/config file, which is undesirable.