Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rules for special characters in github repository name?

In addition to - and _, which other special characters can be contained in a github repository name?

Background

I need to do some regex on github urls, and need to know the rules for repository root urls, which are of the form

https://github.com/username/repo

where

  • username is the username of the owner of the repository, and,
  • repo is the repository name

So far, my regex works well, but doesn't cater to repositories with special characters, so I must include them. Written in R, the regex is github.com/*/[[:alpha:]].

Note: Here are listed the rules for github usernames - I am after the same thing but for repository names

like image 293
stevec Avatar asked Nov 28 '19 04:11

stevec


Video Answer


1 Answers

As mentioned in moby/moby issue 679:

it looks like github allows [A-Za-z0-9_.-], and transforms all other characters to "-".

So: in addition to letters, numbers, - and _ the only other allowable character is '.'

This is illustrated in GitHub Desktop application, with desktop/desktop issue 3090: "Block emoji from being entered as a repo name"(!)

like image 60
VonC Avatar answered Nov 15 '22 08:11

VonC