The RWPickFlavor.podspec specification does not validate - ios

I'm learning by following this tutorial:
https://www.raywenderlich.com/5823-how-to-create-a-cocoapod-in-swift
And I'm stuck in the place where it says:
Using Your New CocoaPod
in the terminal I wrote:
cd ~/Documents/Libraries/RWPickFlavor
pod repo add RWPodSpecs https://github.com/user/RWPodSpecs.git
pod repo push RWPodSpecs RWPickFlavor.podspec
but I get a lot of errors:
[!] /usr/bin/git clone https://github.com/user/RWPodSpecs.git -- RWPodSpecs
fatal: destination path 'RWPodSpecs' already exists and is not an empty directory
and:
Validating spec
-> RWPickFlavor (0.1.0)
- NOTE | url: The URL (https://github.com/user/RWPickFlavor) is not reachable.
- ERROR | [iOS] unknown: Encountered an unknown error ([!] /usr/bin/git clone https://github.com/user/RWPickFlavor.git /var/folders/bw/h527d_4x6yb7rv3tdrldty1c0000gn/T/d20220525-6530-de485a --template= --single-branch --depth 1 --branch 0.1.0
Cloning into '/var/folders/bw/h527d_4x6yb7rv3tdrldty1c0000gn/T/d20220525-6530-de485a'...
warning: Could not find remote branch 0.1.0 to clone.
fatal: Remote branch 0.1.0 not found in upstream origin
) during validation.
[!] The `RWPickFlavor.podspec` specification does not validate.
Any ideas?

I had this very issue and here is how I resolved it:
Verify you are in the ~/Documents/Libraries/RWPickFlavor directory before performing any commands in Terminal.
Verify that the contents of RWPickFlavor.podspec are correct. Mine was not and, if something is wrong, then it will not validate the Podspec.
I went ahead and deleted the remote repository on GitHub and then ran rm -rf .git (again, make sure you are in ~/Documents/Libraries/RWPickFlavor). This step might be excessive, but I figured I had missed something when pushing to GitHub and, since this was just an initial commit, I did not feel like it really harmed anything. Yes, I am aware this is not best practice with regards to version control.
I then went ahead and recreated the remote repository on GitHub.
With the remote repository once again available, I did the following:
git init
git add .
git commit -m "Initial commit"
git tag 0.1.0
git branch -M main
git remote add origin https://github.com/user/RWPickFlavor.git
git push -u origin main --tags
pod repo push RWPodSpecs RWPickFlavor.podspec
Explanation: I think I/we might have forgotten the tag creation in the process and also forgot to include it in the push. Before I deleted the remote repo, I noticed that there was no tag and, even if I added a tag, the Podspec still would not validate.
Hope this is helpful.

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.

What does the git error mean "pathspec did not match any file(s)"

In a Rails app I realised I had committed a sensitive file config/credentials.yml to the git repo.
In an effort to tidy things up I followed the advice on GitHub and ran
git filter-branch --index-filter 'git rm --cached --ignore-unmatch config/credentials.yml' --prune-empty --tag-name-filter cat -- --all
and then added to gitignore
echo "config/credentials.yml" >> .gitignore
When I try to commit these changes
git add .gitignore
git commit -m "ignored credentials.yml"
I'm getting a message
error: pathspec 'adds credentials.yml to gitignore' did not match any file(s) known to git.
How can I fix this error? Or, how can I undo my changes and safely revert to the git history on my remote?
I think you might've forgotten the step
$ git add .gitignore
before trying to commit, or then you mistyped, when you shoud've given
$ git commit -m "Add credentials.yml to .gitignore"
Process advised is highly dangerous [for the repo contents], so one must be really careful to follow all the steps in detail.
Just give a file path while adding file to git add command, it works for me
$ git add mainFolder/.../file.extension
Note: mainFolder would be the folder inside your repo

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