0

I don't understand why, but I can't fully change my git account while I'm pushing commits into the repo on azure. Commits makes by new account, but pushing makes by the old one.

I have done

$ git config --global user.name new

$ git config --global user.email new@new.com

And when I try:

$ git config --global -l

I see:

user.email=new@new.com

user.name=new

but when I try to push new commit, I actually see, that I push from the old account. Literally no idea why!

enter image description here

I logged in with the new account everywhere. In visual studio code, visual studio and azure devops. But still nothing.

Beaver
  • 13
  • 3
  • 1
    Because your azure login didn't change? Who pushed is not a Git matter; it is an Azure matter. Your git config changes are pointless. – matt Apr 26 '22 at 12:00
  • @matt I logged in everywhere with the new account. In visual studio code, visual studio and azure devops. – Beaver Apr 26 '22 at 12:44
  • 1
    In any case, those two config options are strictly for the purpose of creating commits, not for determining how you push. – joanis Apr 26 '22 at 12:52
  • How you push can be determined by a number of things. Start by looking at the output of `git remote -v`, do you have a username embedded in that URL? – joanis Apr 26 '22 at 12:53
  • Do any of the answers here help: https://stackoverflow.com/questions/13103083/how-do-i-push-to-github-under-a-different-username ? – joanis Apr 26 '22 at 12:54
  • There's also here https://stackoverflow.com/questions/29776439/username-and-password-in-command-for-git-push but we'd need more details about how you're connected to your remote (output of `git remote -v` will say) to point you to a relevant answer. – joanis Apr 26 '22 at 12:56
  • @joanis there is no username in url. Looks like that: `https://NameOfMyRepo@dev.azure.com/NameOfMyRepo/SomeProject` – Beaver Apr 27 '22 at 08:18
  • Then this solution ought to work for you: https://stackoverflow.com/a/48970546/3216427 What's most likely happening is that your credential manager is remembering the username and password you entered when you first connected, and you have to go and remove that info from your credential manager, whatever your manager is. The link I pointed to disables the credential manager, which is not the nicest solution. The better solution is to find what credential manager is active on your machine and go fix your credentials in there. – joanis Apr 27 '22 at 12:42
  • But wait, I wasn't paying enough attention: the bit before the `@` *is* a username in the https syntax, so you're actually explicitly telling Git to use `NameOfMyRepo` as your user name for pushing here, I believe. Try `git remote set-url https://NewUserName@dev.azure.com/NameOfMyRepo/SomeProject` and see if that fixes things for you. – joanis Apr 27 '22 at 12:47

0 Answers0