RubyGems behind a proxy: InvalidArgument
The other question (here: ) had solutions that I tried but they didn't work.
I am behind a proxy at work, and can't figure out how to get RubyGems to work through it.
Here's some output to help:
josiah@BOX-OF-DOOOM:/etc$ export HTTP_PROXY=http://jkiehl:supersecret@www-proxy.myproxysdomain.com:开发者_运维百科80/
josiah@BOX-OF-DOOOM:/etc$ sudo gem i cucumber
ERROR: http://rubygems.org/ does not appear to be a repository
ERROR: Could not find a valid gem 'cucumber' (>= 0) in any repository
josiah@BOX-OF-DOOOM:/etc$ sudo gem i -p cucumber
ERROR: While executing gem ... (OptionParser::InvalidArgument)
invalid argument: -p cucumber
josiah@BOX-OF-DOOOM:/etc$ sudo gem i -P cucumber
ERROR: While executing gem ... (OptionParser::InvalidArgument)
invalid argument: -P
josiah@BOX-OF-DOOOM:/etc$ sudo gem i --http-proxy cucumber
ERROR: While executing gem ... (OptionParser::InvalidArgument)
Any ideas? I'm baffled.
Just pass the proxy URL as the --http-proxy
argument.
sudo gem install --http-proxy http://jkiehl:supersecret@www-proxy.myproxysdomain.com:80 cucumber
Another way is to set the environment variable HTTP_PROXY, just make sure that when u declare it you ommit the http:// in the proxy url so the line will look like this
set HTTP_PROXY = username:password@yourproxy:port
Hope this helps
精彩评论