multiple gh auths/accounts on Windows #9013
-
Hey I have a maybe a bit weird issue... I'd like to use separate accounts for work and personal usage, and I do, but the weird issue is, once I auth with an account, another seems to lose it's permissions, though
inside of the .gitconfig files I added
and finaly I've edited both .bashrc and .bash_profile files to have such lines to automate the process for creating a repo and updating it gu(){
repo_name=${PWD##*/}
dir=$(pwd)
rm -rf .git
git init .
if [[ "$dir" == *"/d/coding/work/"* ]]; then
git checkout -b master
git commit --allow-empty -m "init"
git checkout -b test
git commit --allow-empty -m "init"
git checkout -b dev
git add .
git commit -m "init"
repo_name=${PWD##*/}
gh auth switch --user myUser1
gh repo create myWorkOrg/$repo_name --private
git remote add origin https://github.com/myWorkOrg/$repo_name.git
git push -u origin dev
git push origin master
git push origin test
else
gh auth switch --user myUser2
git add .
git commit -m "init"
git branch -M main
gh repo create $repo_name --private
git remote add origin https://github.com/myUser2/$repo_name
git push -u origin main
fi
} And so the problem is once I auth with one of the users, I lose the permission/auth status for another( but gh auth status command shows that everything is fine ) but on practice I'm not able to create or update repos for another user ( only for the one I authorized the most recent time ) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I suspect that you are falling foul of #8875 Could you try running |
Beta Was this translation helpful? Give feedback.
I suspect that you are falling foul of #8875
Could you try running
gh auth setup-git
? This will setgh
as your git credential manager for any hosts you have authenticated with. At that point if youauth switch
things should be working as expected.