2

I've been using a git branch with a remote repo as well (Bit bucket)

I decided to create a new branch so ran this code

Directory= ~/tmp/merge/aaa> git branch iOSUI/beta
Directory= ~/tmp/merge/aaa> git checkout iOSUI/beta
Switched to branch 'iOSUI/beta'

Then tried to push

Directory= ~/tmp/merge/aaa> git push origin iOS7UI/beta
error: src refspec iOS7UI/beta does not match any.
error: failed to push some refs to 'https://xxx/repo.git'

So I tried to create a remote branch

Directory= ~/tmp/merge/aaa> git branch origin iOSUI/beta
error: there are still refs under 'refs/heads/origin'
fatal: Failed to lock ref for update: Is a directory

After that failed I tried through XCode by selecting push and then it pushed successfully to

'origin/iOS7UI/beta'

Again I tried through the command line 2 options

Directory= ~/tmp/merge/aaa> git push origin iOS7UI/beta
error: src refspec iOS7UI/beta does not match any.
error: failed to push some refs to 'https://xxx/repo.git'

and this option with the '/'

Directory= ~/tmp/merge/pixtr> git push origin/iOS7UI/beta
fatal: 'origin/iOS7UI/beta' does not appear to be a git repository
fatal: Could not read from remote repository.
John Topley
  • 113,588
  • 46
  • 195
  • 237
Avba
  • 14,822
  • 20
  • 92
  • 192

1 Answers1

1

The recent default push policy "simple" would prevent you to push to a non-existent branch (unless it is set to be your upstream branch).

You would need to do:

git push -u origin iOS7UI/beta

But check first if the branch from which you have created your iOS7UI/beta is pushed or up-to-date compared to the upstream repo.
If it is behind, that means iOS7UI/beta is based on a parent SHA1 which isn't yet pushed to origin.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250