Switching between accounts in my local computer

kikito's Avatar


26 Jun, 2011 09:58 PM

I have two different accounts on rubygems (one for my personal projects, one for my company work). I must "switch" from one to the other, otherwise I get a "you are not authorized to push" error when trying to push a gem.

It's been a long time since I pushed a gem for my company and I've forgotten what I had to do in order to "switch contexts" in my computer.

I've spent one hour looking for information on how to switch, but I could not find information on it.

What commands / config files do I have to use to tell my computer "I am now user xxx on rubygems, let me push"?

Thanks a lot

  1. Support Staff 1 Posted by Nick Quaranto on 29 Jul, 2011 03:23 PM

    Nick Quaranto's Avatar

    If you upgrade rubygems, there is a new -k option that lets you specify which key to use. Just edit ~/.gem/credentials and drop in your api key in YAML (follow the example there for another entry)

    gem push --help
    Usage: gem push GEM [options]
        -k, --key KEYNAME                Use the given API key
                                         from ~/.gem/credentials
  2. 2 Posted by kikito on 07 Aug, 2011 01:48 PM

    kikito's Avatar

    Thanks! I was finally able to push the gems.

    One question though: it's not possible to have both keys simultaneously active, is it?

    For now, I have both on my credentials file and comment/uncomment the keys as I need them.


  3. 3 Posted by Gabriel Horner on 07 Aug, 2011 07:53 PM

    Gabriel Horner's Avatar

    It's not possible to have both active. But as Nick pointed out, you can switch between keys with -k with recent versions of rubygems. Feel free to reopen if you have more questions.

  4. Gabriel Horner closed this discussion on 07 Aug, 2011 07:53 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac