Git repositories can come in many shapes and sizes that look nothing like that example. See the git-clone
man page for a full list.
Some of the more common ones include using the http
or git
protocols instead of SSH (or, indeed, manually specifying the ssh://
protocol). Usernames are optional, there doesn't have to be a /
or a .git
, ports may be specified, etc etc.
At the moment you're basically only allowing private Github repos, or ones which happen to look like them. Is that what you want? If so, S. Mark's answer looks good!
If you want to accept any git repository, the best bet is probably to make sure it's a valid URI, and then use git
or a git library to make sure there is a real repo accessible at that URI.