Search code examples
iosgitgithubcocoapodspodspec

When I execute git push origin master, why is error: failed to push some refs to 'git@github.com:sshallow/FirstPod.git'


I am learning to create public cocoapods, I have always encountered this problem,

This is the step I tried.

  1. pod lib create FirstPod (Some files are automatically generated,eg,_Pods,FirstPod.podspec,Example)
  2. Add my files to FirstPd/Classes (a custom UIView ,include .h and .m)
  3. Modify the podspec file( s.ios.deployment_target = '9.0' and s.ios.framework = 'UIKit')
  4. cd FirstPod/Example/,then pod install
  5. Execute the following code, error when executing git push origin master

git add -A && git commit -m "Release 0.1.0"

git tag '0.1.1'

git remote add origin git@github.com:sshallow/FirstPod.git

git push --tags

git push origin master 

enter image description here

pod --version 1.7.5

update: I just tried it again according to this tutorial, and it is still the same mistake! enter image description here enter image description here


Solution

  • Make sure to create an empty repository, as opposed to one with an initial README.md file

    That will help avoiding the error message.

    But in your case, if you don't care about said README.md file:

    git push --force -u origin master