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

Viewed 1157

I am trying to install the gem 'apartment' to my rails application, but similarly like this guy I am receiving an error.

build': undefined method new' for "Apartment::Reloader":String (NoMethodError)

Someone has posted a solution:

In order to use Rails 6 you have to use the development branch on github: gem "apartment", git: 'git@github.com:influitive/apartment.git', branch: "development"

but when I try and follow the solution I am receiving the following code:

Does anyone know what is going wrong here?

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. 
2 Answers

It looks like your public key is getting rejected by GitHub. Try to SSH to GitHub, this will confirm that GitHub does recognize your public key and can identify your user:

ssh git@github.com

This will "fail" with a message saying that you cannot SSH to GitHub, but will also be a personalized message with your username. This will confirm that GitHub is able to recognize your key.

Something like this:

-> % 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.

If you do not get a message with your username, then you should add your public key to your GitHub account: https://docs.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account

It works for me.

$ 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.
$ 
Related