Having this issue?
See the Drupal.org Git authentication troubleshooting documentation
Original issue summary
I'm having trouble pushing to the seckit repository as a maintainer.
I believe my remote is set up as per the latest guidelines at https://www.drupal.org/gitauth
seckit$ git remote -v
origin git@git.drupal.org:project/seckit.git (fetch)
origin git@git.drupal.org:project/seckit.git (push)However, I get this error when I try to push:
seckit$ git push
fatal: remote error: You do not have write permissions for the 'seckit' repository.I was able to work around this by changing the remote url to use my username rather than 'git':
seckit$ git remote set-url origin mcdruid@git.drupal.org:project/seckit.git
seckit$ git remote -v
origin mcdruid@git.drupal.org:project/seckit.git (fetch)
origin mcdruid@git.drupal.org:project/seckit.git (push)
seckit$ git push
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 1.40 KiB | 0 bytes/s, done.
Total 6 (delta 4), reused 0 (delta 0)
remote:
remote:
remote: Git authentication methods for Drupal.org hosted projects are changing.
remote:
remote:
remote: Your current git remote mcdruid@git.drupal.org:project/seckit.git must change by executing the following command:
remote:
remote: git remote set-url origin git@git.drupal.org:project/seckit.git
remote:
remote:
remote: Password authentication is being DEPRECATED.
remote:
remote: Review this page for additional information: https://www.drupal.org/gitauth
remote:
remote:
To mcdruid@git.drupal.org:project/seckit.git
19843dc..24c47b9 7.x-1.x -> 7.x-1.xDoing a direct copy-paste of those instructions to change my remote back to the way it was has taken me back to the start again:
seckit$ git remote set-url origin git@git.drupal.org:project/seckit.git
seckit$ git push
fatal: remote error: You do not have write permissions for the 'seckit' repository.I do have an SSH key associated with my account (which I've not changed recently); I'm not using a password.
I can change the remote back and restore my push access, but I'm not sure why following the docs seems to be breaking things!
Comments
Comment #2
drummPlease try
GIT_SSH_COMMAND="ssh -v" git pushwith thegit@git.drupal.org:project/seckit.gitThe verbose output with show what key(s) are being offered by your SSH client. We’ve seen in some cases a username change can affect this.
Comment #3
nikunjkotechaI'm facing same issue
Can see:
debug1: Authentication succeeded (publickey).
I was also able to push tag but not able to push commits. You can check, I pushed the tag rc4 on 15th Aug (yesterday)
Comment #4
mcdruid commentedThanks, it looks like the problem I'm having is caused by SSH agent forwarding.
If I use
ssh-add -Dto remove the key that my SSH agent has loaded, the correct key is offered for authentication by git and everything works as expected.I'll try to work out how to make git use the correct key without removing the other key from the SSH agent, and I can document any successful recipes I come up with here... but I don't think it's an issue for the d.o infrastructure team.
Thanks again for looking; I'm happy for this to be closed, but not sure if @nikunjkotecha still needs it?
Comment #5
nikunjkotechaFor me it says Authentication succeeded (publickey) but still doesn't let me push. With same ssh config I was able to push a tag and that's where I feel it is some issue outside my system.
One thing to note, I'm just a maintainer and not owner of clientside_validation module, not sure if that would make any difference though.
Comment #6
nikunjkotecha@mcdruid I tried again with what you suggested and it worked. So yes, not an issue with infrastructure but something with GIT? BTW, I never faced this issue before repo urls were changed.
Closing ticket for now.
Comment #7
mcdruid commentedI've been able to fix this by adding something like the following to my
~/.ssh/config...per: https://serverfault.com/a/515214
That seems to prevent the SSH agent from offering the wrong key and messing things up.
Depending on which hosts you do want to use the SSH agent for, you may need to set things up differently, but
IdentitiesOnlyseems to be what I needed to make my set up work properly.Comment #8
nikunjkotechaCool, thanks @mcdruid
Comment #9
geerlingguy commentedI'm going to reopen this... it looks like what might be happening is whatever key is first in the list of ssh-agent keys is always accepted by git.drupal.org. But then after that key is accepted, the key doesn't have rights for the particular repository that's in use, therefore the 'you do not have write permissions' error displays.
Here's my verbose output:
The
.ssh/not-my-drupal-org-keyis the first key loaded inssh-agent, but it's not a key that I have in my drupal.org account.I have the same kind of setup with all my GitHub repos, and things work fine there, so maybe there's some issue on the git.drupal.org auth side?
After doing
ssh-add -D(to remove all identities), things work fine again until next time I add a key to my SSH agent.Comment #10
drummYes, I think that’s exactly right. We accept any key for read access, and the access checking for pushes happens later.
This is in preparation for our upcoming move to GitLab, which does not support specific username SSH authentication, only
git@….Fixing this in our existing Git daemon may be possible, although I expect we might not be able to preserve the accepting any keys for read operations behavior. I’m assuming the SSH protocol won’t tell us if there are more keys are available, we have to accept or deny a key without knowing if there are more available.
We can test what will happen with GitLab, and try aligning our server to that. But we do want to get GitLab launched, and time spent on the old infrastructure will delay that.
Comment #11
geerlingguy commentedSounds good to me. Hopefully GitLab supports the right key checking as well as GitHub (I don't see any reason why it wouldn't).
Comment #12
chris matthews commentedI am a new contributor (https://www.drupal.org/project/honeypot_registration), but I am running into this same issue and cannot seem to resolve by following any of the suggestions in this thread so any help would be much appreciated.
Comment #13
chris matthews commentedI just checked the Git access tab in my profile and it lists my old Drupa.org username as my Git username, which I assume is part of the issue.
Comment #14
drummI documented troubleshooting this issue as a client at https://www.drupal.org/drupalorg/docs/user-accounts/git-authentication-f...
Remember, Git remotes will stop working once we are able to move on #3002827: [GitLab] Scheduling Phase 1 of our migration to GitLab.
Chris2 - Drupal.org Git usernames can not be changed. If you are using a username in your Git remote, that is the one to use. Be sure to check a Git command with
GIT_SSH_COMMAND="ssh -v"to see which key is being sent. Your key on your Drupal.org profile looks like it is properly added and should be working.Comment #15
robertwb commentedI needed a slightly different per @macdruid advice in #7 -- I had to specify the identity file.
Comment #16
florianmuellerchIn my case (I'm also just submitting my first module) I forgot to add my SSH keys in my profile.
You can check this documentation and follow it with the new git workflow to identify your problem: https://www.drupal.org/drupalorg/docs/user-accounts/git-authentication-f...
Comment #17
tyleryoungblood commentedIn my case I had to visit the "Git access" section (Profile > Git Access) and check the "I agree to these terms" checkbox, along with choosing my Desired Git username.
So if you're new to drupal.org (as I am) check to make sure you have Git access fully setup before trying any of the other troubleshooting steps. :)
Comment #18
drummThis situation should now be resolved. GitLab only accepts keys that are associated with user accounts. So it won’t accept an unknown key for read-only access, and then deny it for pushes.
Now is a good time to simplify your SSH config, if you’d like to.