programstinator
programstinator

Reputation: 1376

How do I make git use my git username (git config user.name) instead of my system username (whoami)?

When I type whoami in git bash it prints "win-me6mt62nc4m\gugl0", which is my system username. When I type git config user.name (using either --local, --system or --global flags) I get goran as the output, and goran is my username on the git repo I am working on.

My problem is that when I try a git pull it asks for gugl0`s credentials instead of goran's. How can I configure git to expect my git username instead of my system username?

Upvotes: 1

Views: 387

Answers (1)

Jonathan Wakely
Jonathan Wakely

Reputation: 171263

It depends on the config for the git remote, so add the username to the remote URL in the repo's .git/config file e.g.

[remote "origin"]
    url = [email protected]/foo/bar.git
          ^^^^^^

Without a username there Git will assume that the username at the remote host is the same as your local username.

Upvotes: 2

Related Questions