I'm getting totally mad trying to use my two GIT users. Till today, I had only one, but now I create another one, personal and work profiles.
I had two different ssh keys configured, and I've modified my .gitconfig in my user home folder with ifs condition, but nothing change...
Some things I've tried (but nothing works):
- Changing global user to new one. (In
~/.gitconfig) - Setting repository user (In
/path/repository/.git/config) - Having if conditions in my home
.gitconfig - Changing Visual Studio Code git user
I've also tried git config --list --show-origin but first user has been removed for every file shown in this list result.
List returned:
file:/Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig credential.helper=osxkeychain
file:/Users/elenitaex5/.gitconfig push.default=current
file:/Users/elenitaex5/.gitconfig pull.default=current
file:/Users/elenitaex5/.gitconfig includeif.gitdir:~/projects/.path=~/projects/.gitconfig
file:/Users/elenitaex5/projects/.gitconfig user.name=Elena
file:/Users/elenitaex5/projects/.gitconfig [email protected]
file:/Users/elenitaex5/.gitconfig user.name=Elena
file:/Users/elenitaex5/.gitconfig [email protected]
file:.git/config core.repositoryformatversion=0
file:.git/config core.filemode=true
file:.git/config core.bare=false
file:.git/config core.logallrefupdates=true
file:.git/config core.ignorecase=true
file:.git/config core.precomposeunicode=true
file:.git/config user.name=Elena
file:.git/config [email protected]
file:.git/config [email protected]:elenitaex5/homeManager.git
file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
My error trying to git push:
ERROR: Permission to elenitaex5/homeManager.git denied to elenaphone.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I can't find either... user named like the alias in any file. Does anybody knows another GIT user file? Or where it can be saved?
What I wanna really do?
Having two different git users and make commits in my personal project with my personal user and use work git user to make commits in work project.
Till now, I only needed to use one, but I need two now. I've tried everything to make the second one works, even change the global git user, but nothing works. Somewhere... there's a file having first one as priority and I don't know where...
git commituses the user.name and user.email settings to make commits. Once made, no commit can ever be changed (by anyone or anything, includinggit push) and the user settings are completely irrelevant. Thegit pushoperation does authentication (if it does any at all) using third-party non-Git software. The method by which this authentication works depends on both the protocol (https vs ssh for instance) and the OS, and on helper software. So you need to specify these.