Answer a question

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

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"(!)

Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐