Heroku 密钥:使用不同的路径添加我的密钥

发布于 2024-10-18 05:09:12 字数 1681 浏览 2 评论 0原文

我的 SSH 密钥与我的根目录关联,并且没有与每个用户关联。当我尝试将密钥添加到 Heroku 时,我得到以下响应:

skline-mac:~ skline$ heroku keys:add
No ssh public key found in /Users/skline/.ssh/id_[rd]sa.pub.  You may want to specify the full path to the keyfile.

这是有道理的,因为我的 ssh 密钥实际上位于 /var/root/.ssh/id_rsa.pub。我怎样才能告诉heroku在那里寻找我的ssh密钥?

请注意,因为我已使用以下命令锁定当前用户的 ssh 目录: $ chmod 700 ~/.ssh 和 $ chmod 600 ~/.ssh/*。我不再知道如何访问这些目录。抱歉,我是 OSX 新手

另外,当我尝试使用 sudo 执行相同的命令时,我得到:

skline-mac:~ skline$ sudo heroku keys:add 
/Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:861:in `report_activate_error': Could not find RubyGem heroku (>= 0) (Gem::LoadError)
    from /Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:255:in `activate'
    from /Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:1204:in `gem'
    from /Users/skline/.rvm/gems/ruby-1.9.2-p136@rails3tutorial/bin/heroku:18:in `<main>'

注意,当我尝试 heroku keys:add /var/root/.ssh/id_rsa.pub 时,我也遇到此错误:add /var/root/.ssh/id_rsa.pub 我收到此错误:

skline-mac:~ skline$ heroku keys:add /var/root/.ssh/id_rsa.pub
/Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:861:in `report_activate_error': Could not find RubyGem heroku (>= 0) (Gem::LoadError)
    from /Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:255:in `activate'
    from /Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:1204:in `gem'
    from /Users/skline/.rvm/gems/ruby-1.9.2-p136@rails3tutorial/bin/heroku:18:in `<main>'

My SSH keys are associated with my root directory and have none associated with each user. When I try to add my keys to heroku i get this response:

skline-mac:~ skline$ heroku keys:add
No ssh public key found in /Users/skline/.ssh/id_[rd]sa.pub.  You may want to specify the full path to the keyfile.

This makes sense because my ssh keys are actually located at /var/root/.ssh/id_rsa.pub. How can I tell heroku to look for my ssh keys there?

Note, because I have locked my ssh directory on my current user using: $ chmod 700 ~/.ssh and $ chmod 600 ~/.ssh/*. I no longer know how to access these directories. Sorry I am new to OSX

Also, when I try to do the same command using sudo, I get:

skline-mac:~ skline$ sudo heroku keys:add 
/Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:861:in `report_activate_error': Could not find RubyGem heroku (>= 0) (Gem::LoadError)
    from /Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:255:in `activate'
    from /Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:1204:in `gem'
    from /Users/skline/.rvm/gems/ruby-1.9.2-p136@rails3tutorial/bin/heroku:18:in `<main>'

Note I also get this errory when I try heroku keys:add /var/root/.ssh/id_rsa.pub I get this error:

skline-mac:~ skline$ heroku keys:add /var/root/.ssh/id_rsa.pub
/Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:861:in `report_activate_error': Could not find RubyGem heroku (>= 0) (Gem::LoadError)
    from /Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:255:in `activate'
    from /Users/skline/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems.rb:1204:in `gem'
    from /Users/skline/.rvm/gems/ruby-1.9.2-p136@rails3tutorial/bin/heroku:18:in `<main>'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

楠木可依 2024-10-25 05:09:12

最简单地回答您的问题:

heroku keys:add /var/root/.ssh/id_rsa.pub

关于“锁定”您的 /~/.ssh 文件夹,这些权限仍然授予您(其所有者)读取和写入文件的完全访问权限。

当你运行 sudo heroku keys:add 时,它会因为与 RVM + 而不是安装 gem 的用户相关的原因而抛出异常,因此当它尝试加载 gem 时,它不会找到它。至少,这是我对您分享的输出的快速评估。 请参阅下面的评论以进行更正。

To answer your question most simply:

heroku keys:add /var/root/.ssh/id_rsa.pub

Regarding "locking" your /~/.ssh folder, those permissions still give you (their owner) full access to read and write files to them.

And when you run sudo heroku keys:add it throws a fit because of something related to RVM + not the user the gem is installed under, and thus when it tries to load a gem it's not finding it. At least, that's my quick assessment from the output you shared. See comment below for correction.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文