Cannot install gem from github on dev box - ruby-on-rails

I have a gem file which works fine locally. In my gem file one of my gems installs using a github location like so...
gem 'rails3-jquery-autocomplete', :git => 'https://github.com/willfults/rails3-jquery-autocomplete.git'
The problem is when I run ssh into my dev box and run bundle or bundle install I get the following error on my server...
Fetching gem metadata from https://rubygems.org/..
Fetching https://github.com/willfults/rails3-jquery-autocomplete.git
fatal: failed to open '/srv/www/socialu.com/https://github.com/willfults/rails3-jquery-autocomplete.git/objects': No such file or directory
Git error: command `git clone 'https://github.com/willfults/rails3-jquery-autocomplete.git' "/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-186d8dd59401e0d4dd8c2860261d9ba55e0793f2" --bare --no-hardlinks` in directory /srv/www/socialu.com has failed.
How can I resolve such? Thanks.
Update: with the git url I get the following...
Fetching git://github.com/willfults/rails3-jquery-autocomplete.git
remote: Counting objects: 1846, done. remote: Compressing objects:
100% (784/784), done. remote: Total 1846 (delta 1072), reused 1688
(delta 957) Receiving objects: 100% (1846/1846), 481.07 KiB | 764
KiB/s, done. Resolving deltas: 100% (1072/1072), done. ssh: Could not
resolve hostname /srv/www/socialu.com/https: Name or service not known
fatal: The remote end hung up unexpectedly Git error: command git
clone --no-checkout
"/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-6e048304dc5207eafc457581b1fa2d0073d2e1ed"
"/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/bundler/gems/rails3-jquery-autocomplete-060f2bea5e46"
in directory /srv/www/socialu.com has failed. If this error persists
you could try removing the cache directory
'/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-6e048304dc5207eafc457581b1fa2d0073d2e1ed'

It is a path issue, as you can see the URL is mixed with folder path.
Try to use git:// URL instead of https://.
Not sure if it will work, but it is a path issue somewhere.
Also check your rubygems version on the server, and update it if needed (latest is v1.8.24). There is something different on your machine if it works as is.
gem -v
Hope that helps.

Related

How does a Ruby gem becomes invalid?

My Ruby on Rails dev server has been running for a while on Windows 2016 server. But I had to restart it yesterday.
Then it raised the following error:
The git source https://github.com/fchampreux/write_xlsx_rails.git is not yet checked out. Please run `bundle install` before trying to start your application
I don't understand where this suddenly comes from !?! I created this gem 2 years ago by forking an obsolete version from DatozMX/write_xlsx_rails. And it used to work as expected. It is declared in Gemfile as the following:
# XLSX format support
gem 'write_xlsx'
gem 'write_xlsx_rails', git: 'https://github.com/fchampreux/write_xlsx_rails.git', branch: 'master'
If I replace the remote reference by the former local path (used when updating the gem), the gem is made available. But this cannot be used for deployment.
So I tried to run bundle install as suggested, and I get the following error:
Retrying `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 --single-branch --branch master -- https://github.com/fchampreux/write_xlsx_rails.git
C:/Ruby27-x64/lib/ruby/gems/2.7.0/cache/bundler/git/write_xlsx_rails-858752332ce805e34a469f55ad6a2b115033800a` at C:/Sites/sis-portal due to error (2/4):
Bundler::Source::Git::GitCommandError Git error: command `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 --single-branch --branch master -- https://github.com/fchampreux/write_xlsx_rails.git
C:/Ruby27-x64/lib/ruby/gems/2.7.0/cache/bundler/git/write_xlsx_rails-858752332ce805e34a469f55ad6a2b115033800a` in directory C:/Sites/sis-portal has failed.
fatal: unable to access 'https://github.com/fchampreux/write_xlsx_rails.git/': SSL certificate problem: self signed certificate in certificate chain
As other gems are correctly updated by the Bundler, I suspect a certificate issue. But why only on this gem from my GitHub repository? This is beyond my competency!
I finally solved the problem by updating Git.
We use the SSL version built into Git install. We installed it more than 2 years ago ... and its certificates were over 2 years old and had expired.

Rails Heroku Gemfile.lock error - push rejected (open source)

I am trying to push my open source RoR application to Heroku but I'm having an issue making the initial push. I have read many similar questions, but none of those answers has helped to solve my problem. I have tried bundle update and bundle install various times. I also have tried removing and then re-committing my Gemfile.lock file, however I get this same error still...
$ git push heroku master
Counting objects: 5199, done.
Compressing objects: 100% (3086/3086), done.
Writing objects: 100% (5199/5199), 4.57 MiB | 131 KiB/s, done.
Total 5199 (delta 3418), reused 3152 (delta 1962)
-----> Removing .DS_Store files
-----> Ruby app detected
-----> Compiling Ruby/NoLockfile
!
! Gemfile.lock required. Please check it in.
!
! Push rejected, failed to compile Ruby app
To git#heroku.com:frozen-springs-4725.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:frozen-springs-4725.git'
Since my application uses MongoDB with MongoMapper, I suspect that I have some configuration incorrect. My code can be found here on Github (I'm currently working on the heroku branch). Feel free to clone our repository and try it yourself.
If anyone has any insight which could help me resolve this issue I would be very thankful!
Or better just run
git push heroku heroku:master
This will push your heroku branch to the master branch on heroku, which is the one heroku use's (Heroku ignores everything but the master branch).
Please read this article first.
Branches pushed to Heroku other than master will be ignored by this command. If you’re working out of another branch locally, you can either merge to master before pushing, or specify that you want to push your local branch to a remote master. To push a branch other than master, use this syntax:
$ git push heroku yourbranch:master

Gem file with git remote failing on heroku push

I have the following line in my gemfile:
gem 'client_side_validations', :git => "git#github.com:Dakuan/client_side_validations.git", :branch => "master", ref: '2245b4174ffd4b400d999cb5a2b6dccc0289eb67'
The repo it's pointing at is public and I can run bundle install / update locally just fine. When I try to push to Heroku I get the following error:
Fetching git#github.com:Dakuan/client_side_validations.git
Host key verification failed.
fatal: The remote end hung up unexpectedly
Git error: command `git clone 'git#github.com:Dakuan/client_side_validations.git' "/tmp/build_1xa9f06n4k1cu/vendor/bundle/ruby/1.9.1/cache/bundler/git/client_side_validations-56a04875baabb67b5f8c192c6c6743df476fd90f" --bare --no-hardlinks` in directory /tmp/build_1xa9f06n4k1cu has failed.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
Anyone got any ideas about what's going on here?
Use this GitHub URL instead: git://github.com/Dakuan/client_side_validations.git
The git#github.com:… URL is the writable SSH version, which requires authentication with an SSH key connected to a GitHub account that has write access to the repository.
The git://github.com/… URL is the public, read-only version.
Since the gem you're using is in a public GitHub repository, you can also use this shorthand in your Gemfile:
gem 'client_side_validations', :github => 'Dakuan/client_side_validations'
See the Bundler Git documentation for more information.
A late second answer, as I ran into some confusing output from Heroku's build logs which stumped me for a while.
If you have multiple Github hosted gems in your Gemfile, and one of them is inaccessible (in my case, I had accidentally pointed to a private repo of mine), the build logs throw an error like Username not found or Repository not found for all the Github hosted gems - even those that are available.

bundle install leads to git clone error. Not sure what this response means

Getting a strange error on bundle install..
bundle install
Fetching gem metadata from http://rubygems.org/.....
Fetching gem metadata from http://rubygems.org/..
Fetching git://github.com/maccman/gdata.git
fatal: The remote end hung up unexpectedly
Git error: command `git clone 'git://github.com/maccman/gdata.git' "/Users/elephanttrip/.rvm/gems/ruby-1.9.2-p318#shasta/cache/bundler/git/gdata-811f852468ac76e0019108d8c5320da12b6683d4" --bare --no-hardlinks` in directory /Users/elephanttrip/Sites/shasta has failed.
This wasn't happening until I installed the mysql2 gem and mysql with brew.
Any ideas what this error means?
UPDATE
Also none of the folders it is trying to clone this to exist. It's probably something to do with my bundle paths and juggling .rvm
The problem is not on your end. Trying:
git clone 'git://github.com/maccman/gdata.git' "foobar" --bare --no-hardlinks
Fails on my machine with the same error.
Interestingly a non-bare clone seems to work as expected.
resolution: Clone from the https interface: https://github.com/maccman/gdata.git instead.
In your Terminal write bundle config github.https true
In your Terminal write bundle install
Add your SSH key to the github.
Or as #brice mentioned, you need to add your team to the repo.

push rails app to heroku

I am trying to push a rails application to heroku.
When I get to the last step:
git push heroku master
It doesn't work and gives me these errors:
Counting objects: 85, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (74/74), done.
Writing objects: 100% (85/85), 24.38 KiB, done.
Total 85 (delta 23), reused 0 (delta 0)
-----> Heroku receiving push
! Heroku push rejected, no Rails or Rack app detected.
error: hooks/pre-receive exited with error code 1
To git#heroku.com:smooth-dusk-26.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:smooth-dusk-26.git'
I don't know what I'm doing wrong :(
Here's the answer I got from Heroku and it worked for me (after trying different pg gems, adapters, and everything else on the 10 other posts about this)
1) add the line:
gem 'pg'
to your Gemfile.
2) Run the command bundle install to install the gem into your bundle.
3) Stage the Gemfile and Gemfile.lock changes:
git add Gemfile Gemfile.lock
4) Commit the changes:
git commit -m "Install the pg gem"
5) Redeploy to heroku:
git push heroku master
When you created your Rails application, did you change directory into the directory of the application? You have to perform all the commands from within the application's directory.
rails myapp
cd myapp
I encountered the same errors working through Chapter 1 of Michael Hartl's Rails Tutorial. They were eventually resolved by issuing another git commit command after opening a Heroku account and configuring the SSH keys: git commit -a -m "Heroku recommit"
git push heroku master then succeeded.
I just had the same problem trying to push my app to heroku and none of the above answers fixed it.
I solved the issue by emptying my RVM Gemset with rvm gemset empty, deleting my Gemfile.lock (probably best to just rename it) and reinstalling my gems. Pushing worked fine after this.
For me it was the presence of index.php that fixed it. Heroku seems to check for existence of index.php on pre-commit.
Got the same problem under windows following one of the guides on ror site. After making everything like here http://devcenter.heroku.com/articles/quickstart it was solved.
Seems like problem was because of missing two lines.
cd myapp
git init
Also, if you're on Rails 3.0 make sure you use the cedar stack
heroku create --stack cedar
I went through the Rails Tutorial and didn't have a single problem with Heroku (MAC OS X), but you do have to follow the directions.
First, make sure you add/commit to Git. Then if you're in a -b (branch) you need to checkout into master, then merge the branch. If you've made changes to assets, you need to rake asset:precompile.
If you're having a rack up issue, make sure you have this file => config.ru and the contents should look like this.
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run SampleApp::Application
I'm relatively new to Rails and Heroku, but as I mentioned above, if you're following the tutorial's directions, Heroku is a snap and the directions most definitely work. If not, I highly recommend getting started there!
enter link description here

Resources