Slash in branch name in Gemfile causing error - ruby-on-rails

I have this in my Gemfile (using a branch with a slash):
gem 'ice_cube', github: 'seejohnrun/ice_cube', branch: 'issues/50-from_ical'
Which produces this error:
$ bundle
Updating git://github.com/seejohnrun/ice_cube.git
fatal: ambiguous argument 'issues/50-from_ical': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Git error: command `git rev-parse issues/50-from_ical` in directory
/Users/jp/.rvm/gems/ruby-2.0.0-p0#example/cache/bundler/git/ice_cube-63812451ddbe2391df352dbcaee4a6cf04a9f746 has failed.
If this error persists you could try removing the cache directory
'/Users/jp/.rvm/gems/ruby-2.0.0-p0#example/cache/bundler/git/ice_cube-63812451ddbe2391df352dbcaee4a6cf04a9f746'
Other branches (without slashes) work. Does anyone know how to get around this? Thanks!

Are you sure the issue is the /? I checked the referenced repo and there is no public branch issues/50-from_ical.
I believe the problem is that the branch doesn't exist at all.

Related

"Fatal: Needed a single revision" appears when bundle install

I git pull a project to my local side (MacOS), and I need to perform bundle install before running rails server. However, during this process, when one of the Fetchings was executed, the following error occurred.
I have tried to add branch 'main', but it didn't work.
Fetching http://github.com/RubyMoney/eu_central_bank.git
fatal: Needed a single revision
Revision master does not exist in the repository http://github.com/RubyMoney/eu_central_bank.git. Maybe you misspelled it?
I ran into this issue in an internal project. We did a workaround so I can't test, but I just traced some bundler source code. The code for ref:, tag:, and branch: is all the same. They are treated as synonyms.
This failed:
gem 'my-gem', :git => "https://my-server/my-gem.git", :tag => 'v0.1.0'
The error looked like this...
Fetching https://my-server/my-gem.git
fatal: Needed a single revision
Git error: command `git rev-parse --verify v0.1.0` in directory
We discovered that by default branches are pulled by the git clone, but not all tags. Tags that are not on a branch don't always get pulled. To workaround we just created a branch that contained the tag in question.
In the future it might work if you specify the reference like this...
gem 'my-gem', :git => "https://my-server/my-gem.git", :tag => 'refs/tags/v0.1.0'
If you look at the code I link to in github, you see that triggers the value extra_ref to be set, which triggers an additional git fetch to get that ref specifically.
https://github.com/rubygems/rubygems/blob/6a655a698e952f897d0d014fc11bae4b608528ce/bundler/lib/bundler/source/git/git_proxy.rb#L88-L104
It does a two step process. First it does something like this... (The ./foo is a target directory. It can be anything.)
git clone --bare --no-hardlinks --quiet -- https://my-server/my-gem.git ./foo
Then it does this...
git --git-dir=./foo fetch --force --quiet --tags -- https://my-server/my-gem.git refs/heads/*:refs/heads/* refs/tags/v0.1.0:refs/tags/v0.1.0
which will explicitly get the tag in question.
This second step is done whenever the reference begins with ref/.

about pod installation error in ios project

when i am trying to install the pod its showing errors. how to solve this?
Apples-MacBook-Pro:~ apple$ cd /Users/apple/Desktop/lkmmlkmk
Apples-MacBook-Pro:lkmmlkmk apple$ pod init [!] Existing Podfile found
in directory Apples-MacBook-Pro:lkmmlkmk apple$ pod install Setting up
CocoaPods master repo fatal: ambiguous argument 'HEAD': unknown
revision or path not in the working tree. Use '--' to separate paths
from revisions, like this: 'git [...] --
[...]' fatal: ambiguous argument 'HEAD': unknown revision or
path not in the working tree. Use '--' to separate paths from
revisions, like this: 'git [...] -- [...]'
fatal: ambiguous argument 'HEAD': unknown revision or path not in the
working tree. Use '--' to separate paths from revisions, like this:
'git [...] -- [...]' $ /usr/bin/git -C
/Users/apple/.cocoapods/repos/master fetch origin --progress fatal:
'origin' does not appear to be a git repository fatal: Could not
read from remote repository.
Please make sure you have the correct access rights and the
repository exists. [!] Unable to add a source with url
https://github.com/CocoaPods/Specs.git named master-1. You can try
adding it manually in ~/.cocoapods/repos or via pod repo add.
This problem got solve by re setting the git manually if anyone having same issue just reset the cocoa-pods it will help you.
Go to ~/.cocoapods/repos and run git clone https://github.com/CocoaPods/Specs.git master
it will help you to resolve the solution

Issue when creating my first CocoaPod

I am trying to create my first pod and is following this tutorial:
http://www.sitepoint.com/creating-cocoapods/
But when I do:
pod spec lint GLLingoManager.podspec
I get following error:
$ pod spec lint GLLingoManager.podspec
-> GLLingoManager (0.1.0)
- ERROR | [OSX] unknown: Encountered an unknown error ([!] /Applications/Xcode.app/Contents/Developer/usr/bin/git clone https://github.com/xeppen/GLLingoManager.git /var/folders/v6/tdz6zc7j10j_k0pc1vy627zm0000gn/T/d20160504-76297-8l71fj --template= --single-branch --depth 1 --branch 0.1.0
Cloning into '/var/folders/v6/tdz6zc7j10j_k0pc1vy627zm0000gn/T/d20160504-76297-8l71fj'...
warning: Could not find remote branch 0.1.0 to clone.
fatal: Remote branch 0.1.0 not found in upstream origin
) during validation.
Analyzed 1 podspec.
[!] The spec did not pass validation, due to 1 error.
I dont understand what is wrong. What should I do?
Add a 0.1.0 version for your github repo. Image from Github incase the link dies:
You have pointed to a branch called 0.1.0 in your podspec, and you simply need to push a branch of that name to github. Many people use tags instead of branches to indicate which commit to use for each pod version, and I suggest that you do this instead of pointing to a branch. Please post the source section of your podspec for more specific details.
You can also add a tag to your branch in terminal:
git tag 0.1.0
git push --tags
Sometimes the following command line will create a problem, if you are copy pasting into terminal.
Example
//incorrect
git tag ‘0.1.0’
//Will create a tag ‘0.1.0’
//correct
git tag '0.1.0'
//will create a tag 0.1.0
So better to type the single quotes, it may prevent this kind of unexpected issues.
And go check your repo whether these tags are created properly.

Git: Compare 2 branches in different remotes

I'm using Heroku Pipleines to deploy from a staging environment to production, and want to write a script which compares the two remote repos to see if there are any pending migrations. So I need something along the lines of:
git diff staging/master..production/master
with a filter to check the db/migrate directory.
Any ideas? Thanks.
The man page says the syntax is:
git diff [options] <commit> <commit> [--] [<path>...]
In your case this means:
git diff staging/master production/master -- db/migrate

How to install a plugin from github?

I have tryed to run this code in my console:
script/plugin install git://github.com/apotonick/cells.git
...but i only get an empty folder named "cells" in my "vendor/plugins" dir.
What's wrong?
Check you Git version.
This may be related with you gitconfig file, as described in this thread
The reason is that it appears rails-2.3.5/lib/commands/plugin.rb is trying use git pull to grab the plugin code (see the install_using_git method), which doesn't work right.
Example:
script/plugin install git://github.com/fesplugas/typus.git
mkdir vendor/plugins/typus
cd vendor/plugins/typus
git init
git pull --depth 1 git://github.com/fesplugas/typus.git
That last line exits 1, but that error is being masked by the install_using_git method, and the directory is just rm -rf'ed.
I tracked this down to a conflict with ~/.gitconfig. If I remove these lines it works:
[branch "master"]
remote = origin
merge = refs/heads/master
It appears a naked git pull has problems with these settings.
Actually, the problem would be here because of a global git config file (in your homedir: '~/.gitconfig'), defining a master which may be incompatible with the master expected by the git pull within that specific Git repo.

Resources