1

I am getting zsh: number expected whenever I`m running the following command:-

Command - git push --set-upstream origin branch_name

I`m using Oh My Zsh as my terminal in MacBook Pro with M1 chip.

I even tried another command like git push -u origin my_branch, but this also not working giving out the same error message zsh: number expected

More on use of --set-upstream here & why do we need to do it all the time is here.

Lakshay Rohilla
  • 1,654
  • 6
  • 9
  • 30
  • I can't reproduce it with a branch named either `branch_name` or `my_branch`. Perhaps the message comes from one of your [git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks)? Did you try to temporarily [disable your hooks](https://gist.github.com/MrSwed/4bb4e0a8c2a2f35827e6d9b410642582)? – user1934428 Mar 22 '22 at 12:49
  • Have you tried put any library inside the brackets, for instance - `git push --set-upstream origin resampling(asyncio)` – Lakshay Rohilla Apr 22 '22 at 10:20
  • You would have to quote the last argument, i.e. `'resampling(asyncio)'`, otherwise zsh takes it as filename generation flags. – user1934428 Apr 22 '22 at 11:24
  • Alright, I`ll try that out too. Thank you for your suggestion – Lakshay Rohilla Apr 22 '22 at 18:24

1 Answers1

3

I got the solution for this issue:

Earlier I was running git push --set-upstream origin branch_name, with some library name in the branch name within the brackets.

For instance: git push --set-upstream origin resampling(asyncio)

What I found out is, () usually treats the content somehow differently.

And I was having zsh: number expected error as it was expecting a version number for the mentioned library.

To resolve this, I made a new branch and removed () from the branch name & the same command git push --set-upstream origin branch_name worked fine.

Hope this answer would be helpful for the community.

Lakshay Rohilla
  • 1,654
  • 6
  • 9
  • 30