Which characters are illegal within a git remote name ?
I didn't found it the git documentation.
origin = the default name of the remote repository on GitHub corresponding to the repo you're currently in on your machine. master = the default name of the initial branch of a repository. So, "origin master" is the default branch of your repository on GitHub.
The remote name is a short-hand label for a remote repository. "origin" is the conventional default name for the first remote and is usually where you push to when you don't specify a remote for git. You can set up more than one remote for your local repo and you use the remote name when pushing to them.
If you clone a repository, the command automatically adds that remote repository under the name “origin”. So, git fetch origin fetches any new work that has been pushed to that server since you cloned (or last fetched from) it.
REMOTE-NAME is the name of your remote repository. For example: origin. BRANCH-NAME is the name of your branch. For example: develop.
I didn't find anything in the documentation, either. So let's take a look at the source.
When you try to add a remote with an invalid name or rename a remote to an invalid name, you'll get an error message like
fatal: 'foo@{bar' is not a valid remote name
So let's search the Git source for that.
We see that Git goes about this a bit backwards: It tests (here for add
ing, here for renaming (mv
)) whether refs/heads/test:refs/remotes/<the remote name>/test
is a valid fetch reference, as determined by valid_fetch_refspec(<the ref name>)
, which in turn calls parse_refspec_internal(...)
.
The latter does many checks that will most of the time pass anyway due to the majority of the input being given in our case, but it will also call check_refname_format(...)
on the right-hand side (i.e. the refs/remotes/<the remote name>/test
part if the splitting at :
went alright).
I guess this means that the characters and character sequences disallowed for branches and tags are also forbidden for remote short names.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With