I'm performing a release of a project on Github using Maven. release:prepare
fails with:
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] remote: Permission to FOO/BAR.git denied to BAZ.
[ERROR] fatal: unable to access 'https://github.com/FOO/BAR.git/': The requested URL returned error: 403
The weird thing is that BAZ
is the "wrong" github.com
account. It is one of two user names I use on Github, but not one I have ever used with the BAR
project. Let's say the right account is FIZZ
.
SCM settings don't specify a user name:
<scm>
<connection>scm:git:https://github.com/FOO/BAR.git</connection>
<url>scm:git:https://github.com/FOO/BAR.git</url>
<developerConnection>scm:git:https://github.com/FOO/BAR.git</developerConnection>
...
</scm>
(FOO
is an organization that I'm part of.) In fact, I can't figure out where on earth BAZ
is coming from. It's not in ~/.gitconfig
or .git/config
. There is no ~/.m2/settings.xml
file. My Maven settings.xml
file says nothing about Github.
If I use git
on the command line it works -- push
is fine for example.
Can anyone tell me where else this might be coming from? a hidden config file or directory somewhere, whether Maven- or Git-related?
Or, what's the best practice for recording the Github user to use in a private local file, like a Maven settings.xml
or .git/config
, such that I need not put my own user into the build file?
I'm using Mac OS X.
Finally figured this out. The problem is that I'm on OS X, and had logged in to my second account
BAZ
via Safari. This saved the username and password forhttps://github.com
in Keychain. Apparently, the Maven SCM plugin consults this for HTTPS URLs, althoughgit
won't. After clearing Keychain, it correctly prompted me for a username and password.