What characters are illegal in a remote git name?

What characters are illegal in git remote name?

I did not find the git documentation.

+4
source share
2 answers

I did not find anything in the documentation. So let's look at the source.

When you try to add a remote with an invalid name or rename the deleted file to an invalid name, you will receive an error message, for example

fatal: 'foo @ {bar' is not a valid remote name

So let's find the Git source for this .

, Git : ( add ing, (mv)), refs/heads/test:refs/remotes/<the remote name>/test , valid_fetch_refspec(<the ref name>), , , parse_refspec_internal(...).

, - , , call check_refname_format(...) (.. refs/remotes/<the remote name>/test, : ).

, , , , .

+5

das-g , . , , git check-ref-format, .

- , check-ref-format. , [a-f], , ! , fade . , ... Git 160- SHA-1 , 40 , e05806da9ec4aff8adfed142ab2a2b3b02e33c8c.

" ", core.abbrev, 7. git config, , , , , 4 (, , ). , Git, , master - 40- , e05806d Git :

$ git reflog
e05806d HEAD@{0}: checkout: moving from ...

, cab, ( ) " " ( , 3243, , , faded 1027565). , cab 4, , . faded .

Git , 160- faded, , ​​ !

Git (4), , , e058 1 Git Git :

$ git show e058
error: short SHA1 e058 is ambiguous.
error: short SHA1 e058 is ambiguous.
fatal: ambiguous argument 'e058': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
$ git rev-list --all | grep '^e058'
e05806da9ec4aff8adfed142ab2a2b3b02e33c8c
e05881a4577cedca4d7456b3cb1f8bbd6f480df2
$ 

, , fade, ( , fade...). , - , Git . , , commit e0580:

$ git branch e0580 e0580^
$ git show e0580
warning: refname 'e0580' is ambiguous.
commit af09003b2897db76cefdb08ab363ed68f2bb295b
Merge: 58fcd54 b22d748
[snip]
$ git branch -d e0580
Deleted branch e0580 (was af09003).

(af09003 e0580, core.abbrev). , , , , .

git check-ref-format. , , , , () (b) 40 . , 40 - SHA-1, SHA-1.

sha1_name.c, 580, Git , , 40- . , refs.c . , .


1 e058, , - :

$ git rev-list --all --objects | grep '^e058'
e05806da9ec4aff8adfed142ab2a2b3b02e33c8c
e05881a4577cedca4d7456b3cb1f8bbd6f480df2
e058d184d1c072bd3078fe17ad41f1026f093201 t/t7008-grep-binary.sh
e05827cba5488fb0c45e7055194071e1fda0df13 Documentation
e058ad2324a89ad5e10a80acf947253eac6c41e1 
$ git cat-file -t e058ad2324a89ad5e10a80acf947253eac6c41e1
tree

Git "", , git log, , Git , , - .)

+1

Source: https://habr.com/ru/post/1665707/


All Articles