I'm working on multiple projects and those projects are connected to different github account. my main project's config was set using git config --global user.name "firstusername"
and the second project used git config user.name "secondusername"
. but when I tried connecting the second one to github using git push -u origin main
, it says Permission to secondusername/secondusername.github.io.git denied to firstusername
.
when I open gitbash on the second project folder and run git config user.name
it gives secondusername
, but when I run git config --list --show-origin
the credentials says like this
...
file:C:/Users/home/.gitconfig user.name=firstusername
file:C:/Users/home/.gitconfig user.email=firstemail@gmail.com
...
but when I checked the secondproject/.git/config
file the contents looks like this
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[user]
name = secondusername
email = secondemail@gmail.com
[remote "origin"]
url = https://github.com/secondusername/secondusername.github.io.git
fetch = +refs/heads/*:refs/remotes/origin/*
what am I doing wrong??