What's the purpose of the colon in this git repository url?

前端 未结 3 819
再見小時候
再見小時候 2021-02-19 08:23

Please pardon my ignorance; I\'m new to Git and not sure where better to look for an answer, but what\'s the purpose of the colon after \'example.com\' in the following url (whi

3条回答
  •  深忆病人
    2021-02-19 08:54

    The colon is notation which indicates to git the string after defines the repository you wish to interact with.

    edit: Well spotted

    As we can see the remote add is as follows:

    git remote add [-t ] [-m ] [-f] [--tags|--no-tags] [--mirror]  
    

    and your example is:

    git remote add repo_name ssh://serveradmin%example.com@example.com:/home/45678/domains/git.example.com/html/example.git
    

    where 'name' is 'repo_name'

    and URL is the big string

    ssh://serveradmin%example.com@example.com:/home/45678/domains/git.example.com/html/example.git

    which is even more apparent when we see it has the ssh protocol definition at the beginning.

    In a URL you can define the colon without the proceeding port value and the default port for that protocol is generally used as the port number which seems to be what is happening here.

    Therefore markup for the question and mark up for harpo's comment

提交回复
热议问题