I have two accounts on Github (let's say they are a1
and a2
). With my a2
profile, I created an origanization and a new repository for it (from Github's website). My computer has the following ~/.gitconfig
file:
[core]
editor = pico
[user]
name = a1
email = mail_a1@example.com
(because most of the time I use my a1
account).
Now I wanted to work on the repository of the organisation I created with a2
so I did the following:
cd project_folder
touch README.md
git init
git config --local user.name a2
git config --local user.email "mail_a2@example.com"
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/myorganisation/myrepo.git
Then, just to be sure my commit was done by a2
, I did git log
, obtaining:
commit e8dd182a12023a490cb2f099ea8b3a94afe6b81b
Author: a2 <mail_a2@example.com>
Date: Wed Dec 14 17:12:10 2016 +0100
first commit
Great. But when I tried to git push -u origin master
, I got a 403 message saying that I was trying to push as a1
:
remote: Permission to hivex-unipd/swedesigner.git denied to gigiobello.
fatal: unable to access 'https://github.com/myorganisation/myrepo.git/': The requested URL returned error: 403
Did I forget something? Why does Github thinks I'm a1
even after I'v configured my local repository with the a2
account?