尝试安装 gem:公寓:致命:无法从远程存储库读取

Trying to install gem: apartment : Fatal: Could not read from remote repository

我正在尝试安装 gem 'apartment' to my rails application, but similarly like this guy 我收到错误消息。

build':“Apartment::Reloader”的未定义新方法:String (NoMethodError)

有人发布了解决方案:

为了使用 Rails 6 你必须使用 github 上的开发分支: gem“公寓”,git:'git@github.com:influitive/apartment.git',分支:“发展”

但是当我尝试按照解决方案进行操作时,我收到了以下代码:

有人知道这里出了什么问题吗?

Kanes-MacBook-Pro:WOP kaneandrewgibson$ bundle install
Fetching git@github.com:influitive/apartment.git
Warning: Permanently added the RSA host key for IP address '140.82.118.3' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Retrying `git clone 'git@github.com:influitive/apartment.git' "/Users/kaneandrewgibson/.rvm/gems/ruby-2.7.0/cache/bundler/git/apartment-6709fa3e722fdd9cbc3cc58605f2356b6f881214" --bare --no-hardlinks --quiet` due to error (2/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'git@github.com:influitive/apartment.git' "/Users/kaneandrewgibson/.rvm/gems/ruby-2.7.0/cache/bundler/git/apartment-6709fa3e722fdd9cbc3cc58605f2356b6f881214" --bare --no-hardlinks --quiet` in directory /Users/kaneandrewgibson/Desktop/Charlie/WOP has failed.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Retrying `git clone 'git@github.com:influitive/apartment.git' "/Users/kaneandrewgibson/.rvm/gems/ruby-2.7.0/cache/bundler/git/apartment-6709fa3e722fdd9cbc3cc58605f2356b6f881214" --bare --no-hardlinks --quiet` due to error (3/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'git@github.com:influitive/apartment.git' "/Users/kaneandrewgibson/.rvm/gems/ruby-2.7.0/cache/bundler/git/apartment-6709fa3e722fdd9cbc3cc58605f2356b6f881214" --bare --no-hardlinks --quiet` in directory /Users/kaneandrewgibson/Desktop/Charlie/WOP has failed.

Retrying `git clone 'git@github.com:influitive/apartment.git' "/Users/kaneandrewgibson/.rvm/gems/ruby-2.7.0/cache/bundler/git/apartment-6709fa3e722fdd9cbc3cc58605f2356b6f881214" --bare --no-hardlinks --quiet` due to error (4/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'git@github.com:influitive/apartment.git' "/Users/kaneandrewgibson/.rvm/gems/ruby-2.7.0/cache/bundler/git/apartment-6709fa3e722fdd9cbc3cc58605f2356b6f881214" --bare --no-hardlinks --quiet` in directory /Users/kaneandrewgibson/Desktop/Charlie/WOP has failed.

Git error: command `git clone 'git@github.com:influitive/apartment.git' "/Users/kaneandrewgibson/.rvm/gems/ruby-2.7.0/cache/bundler/git/apartment-6709fa3e722fdd9cbc3cc58605f2356b6f881214" --bare
--no-hardlinks --quiet` in directory /Users/kaneandrewgibson/Desktop/Charlie/WOP has failed. 

对我有用。

$ git clone https://github.com/influitive/apartment.git
Cloning into 'apartment'...
remote: Enumerating objects: 5149, done.
remote: Total 5149 (delta 0), reused 0 (delta 0), pack-reused 5149
Receiving objects: 100% (5149/5149), 1.25 MiB | 2.24 MiB/s, done.
Resolving deltas: 100% (2720/2720), done.
$ 

您的 public 密钥似乎被 GitHub 拒绝了。尝试通过 SSH 连接到 GitHub,这将确认 GitHub 确实识别您的 public 密钥并可以识别您的用户:

ssh git@github.com

这将“失败”并显示一条消息说您无法通过 SSH 连接到 GitHub,但也将是一条带有您的用户名的个性化消息。这将确认 GitHub 能够识别您的密钥。

像这样:

-> % ssh git@github.com
PTY allocation request failed on channel 0
Hi karlwilbur! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

如果您没有收到包含您的用户名的消息,那么您应该将 public 密钥添加到您的 GitHub 帐户:https://docs.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account