Can't clone repository with Rugged - ruby

Using openSUSE and Ubuntu with installed dependencies I can't clone the remote repository with Rugged::Repository.clone_at method and getting the error message:
Rugged::NetworkError: This transport isn't implemented. Sorry
The code:
credentials = Rugged::Credentials::SshKey.new(:privatekey=>'path/to/privatekey', :publickey=>'path/to/publickey', :passphrase=>'passphrase')
Rugged::Repository.clone_at 'ssh://github.com/vmoravec/repo', 'dir/to/destination', :credentials => credentials
My Gemfile for a rails project contais reference to the github repo like this:
gem 'rugged', git: 'git://github.com/libgit2/rugged.git', branch: 'development', submodules: true
The gem has been installed with command bundle install --path bundle/
The cloning does not work even with using bundle exec rails console
Installed system packages:
libssh2, libssh2-devel
openssl, libopenssl-devel, libopenssl
There is already similar question asked here on SO, but the solution does not work (although it's for MacOS I think): Getting Rugged::NetworkError on #connect

Removing the bundle/ directory and reinstalling the gems with bundle install --path bundle/ resolved the issue on both systems. It seems that the build system was not able for some reasons to detect the /usr/lib64/libssh2.so.1 dependency required for ssh transport. Carlos, thanks for the hint to use ldd rugged.so to check that.

Related

Where does Bundler install gems pulled from Github?

I want to put a debugger in a file for testing, but can't find where Bundler installs gems pulled from Github on my local machine.
I've looked at this thread http://bundler.io/v1.5/git.html which shows how to setup a local file repo to pull from, but I would rather avoid this as my situation is a one off debugging scenario.
I use rbenv for my ruby and gem management. When I pull in a gem from a git repo, it places the files for the gem here:
/usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/gem-name-SHA/
On my machine bundler installed the gem in:
~/.rvm/gems/ruby-2.3.3/bundler/gems/gem-from-github
gem which [GEM] doesn't work on its own, but bundle exec gem which [GEM] does.

Migration from SVN to GIT repository

I found this nice article to migrate from SVN to GIT repo:
http://www.troyhunt.com/2014/08/migrating-from-subversion-to-git-with.html
This method using Ruby's svn2git tool to migrate but I am not able to install svn2git due to below error:
ERROR: Could not find a valid gem 'svn2git' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (https://rubygems.org/specs.4.8.gz)
Found below link to resolve above issue:
https://gist.github.com/luislavena/f064211759ee0f806c88#manual-solution-to-ssl-issue
But the solution is already present in current Ruby installation. What else can be the problem?
Ruby version- 2.3.0
Plaform: Windows 8
PS:I cannot use SubGit tool.
It was a proxy server issue! I was accessing internet via proxy.
Used the below command to solve the issue:
set http_proxy=username:password#hostname:port
Thanks all.
Make sure you have installed git-svn tool installed, besides git-core.
sudo apt-get install git-svn
After, make sure you have successfully installed svn2git gem.
gem install svn2git
From your error message, I assume you haven't done this successfully.

Gem from custom git repository is not available

I tried to modify an existing gem and forked the git repository.
I added some commits and pointed bundler to my GitHub repository.
bundler update does recognise the change and downloads my version of the gem.
Anyway when I try to launch the application which depends on that gem (testkitchen) my changes aren't available. And when I delete the official version of the gem my version is not found/used and the app fails.
The weird thing is that all the official gems are installed to /var/lib/gems and my version goes to ~/.bundler
gem environment also shows up the correct directories
- GEM PATHS:
- /var/lib/gems/2.2.0
- /home/ansible/.bundler/ruby/2.2.0
I'm not using rvm or similar. Am I doing something wrong?
As #matt pointed out I forgot to add bundle exec to my commands.

berks install found nothing to rewrite

I am using a Windows 7 x64 computer, with ChefDK 0.3.0-1 installed, with the berkshelf, and omnibus gems installed as well. I setup my Berksfile and metadata.rb files as such
metadata.rb
depends 'users', '~> 1.7'
depends 'sudo', '~> 2.6'
Berksfile
cookbook 'users', git: 'https://github.com/sethvargo-cookbooks/users.git', rel: 'cookbooks/users', tag: 'v1.7.0'
cookbook 'sudo', git: 'https://github.com/opscode-cookbooks/sudo.git', rel: 'cookbooks/sudo', tag: 'v2.6.0'
I set the environment variable in my System Environment Variables to:
BERKSHELF_PATH=C:/
However, when I issue the command:
> berks install
I get the following error:
C:\c\c\cookbook_test> berks install
Resolving cookbook dependencies...
Fetching 'addm_setup' from source at .
Fetching 'sudo' from https://github.com/opscode-cookbooks/sudo.git (at v2.6.0/cookbooks/sudo)
Git error: command `git filter-branch --subdirectory-filter "cookbooks/sudo" --force` failed. If this error persists, try removing the cache directory at 'C:/chef/.cache/git/6f5ef5c786d127e1b549253a13b5d48c181aedeb'.Output from the command:
Found nothing to rewrite
I figured out I can't use the Cygwin Git, either because I don't know what to configure for it or something, and that the Git from git-scm works so far. I'm also using Windows Command Prompt to execute these commands. I'm not sure what to do from here, or what this is trying to tell me.
Unfortunately, and fortunately, this was a simple answer. I was receiving the errors listed in the question because I had the
rel: 'cookbooks/sudo'
What that was doing was looking for a pre-existing repository, but that didn't exist. So, once I removed that, the cookbooks were downloaded and included for use.
The new results were:
C:\c\c\cookbook_test> berks install
Resolving cookbook dependencies...
Fetching 'cookbook_test' from source at .
Fetching 'sudo' from https://github.com/opscode-cookbooks/sudo.git (at v2.6.0)
Fetching 'users' from https://github.com/sethvargo-cookbooks/users.git (at v1.7.0)
Fetching cookbook index from https://supermarket.getchef.com...
Using cookbook_test (0.1.0) from source at .
Using sudo (2.6.0) from https://github.com/opscode-cookbooks/sudo.git (at v2.6.0)
Using users (1.7.0) from https://github.com/sethvargo-cookbooks/users.git (at v1.7.0)

Error while fetching git file using Bundler

Gemfile:
source "http://rubygems.org"
gem "nokogiri", :git => "git://github.com/tenderlove/nokogiri.git"
When I run bundle, the following error occurs:
Fetching git://github.com/tenderlove/nokogiri.git
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/source.rb:592:in ``': No such file or directory - git clone "git://github.com/tenderlove/nokogiri.git" "C:/Ruby193/lib/ruby/gems/1.9.1/cache/bundler/git/nokogiri-d4bf05cb9e65f144f074351e5ebe3a0e44c00952" --bare --no-hardlinks (Errno::ENOENT)
How can I solve it?
It's reproducible not only with this gem but also with other gems: cucumber, capybara
I use Windows.
It was because I didn't have Git installed.
I installed Git and added it into PATH system variable. bundle became to work after that
For any other newbies out there, I installed Git on Windows 7 with msysgit.
Then in the msysgit command window (MINGW32) I moved to my rails project directory and ran bundle install and it worked fine.
Thanks for helping me with this Andrey.

Resources