'git checkout gives zsh: no matches found:
My colleague created a branch. I am trying to checkout to the branch.
git checkout hisName/branchNameWithAHash#Inside
The terminal returns
zsh: no matches found: hisName/branchNameWithAHash#Inside
If I do git branch -r, I can see the remote branch does exist:
origin/HEAD -> origin/master
origin/hisName/branchNameWithAHash#Inside
origin/master
Why am I getting no matches found?
Solution 1:[1]
It turns out I need to put quotes around the branch name if it contains a special character like a hash sign #
with git checkout 'hisName/branchNameWithAHash#Inside'
I get now:
Branch 'grzegorz/configureAWSAmplify_#PROAP-320' set up to track remote branch 'hisName/branchNameWithAHash#Inside' from 'origin'.
Switched to a new branch 'hisName/branchNameWithAHash#Inside'
I tested only 'single quotes' but I think "double quotes" should work as well.
Thanks @user1934428
to your comments and links @phd it seems to be an issue with my zsh config.
Entering unsetopt EXTENDED_GLOB fixed the issue.
Now if I enter echo stringwithhash# I am getting stringwithhash# whereas before it was zsh: no matches found: stringwithhash#
Solution 2:[2]
I had a similar error while adding helm repo on my macOS like the following:
helm repo add chart-alias-name git+ssh://[email protected]/user/repo-name@chart/path?ref=ref-tag
> zsh: no matches found: git+ssh://[email protected]/user/repo-name@chart/path?ref=ref-tag
and I have fixed the problem by adding quotes around the full git URL like the following:
helm repo add chart-alias-name "git+ssh://[email protected]/user/repo-name@chart/path?ref=ref-tag"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | hbceylan |
