Using a remote repository with non-standard port

前端 未结 5 1723
面向向阳花
面向向阳花 2020-11-27 11:22

I am setting up my local git project for a remote repository. The remote repository is being served on a non-standard port (4019).

But it doesn\'t work. Instead I ge

5条回答
  •  暖寄归人
    2020-11-27 11:50

    SSH based git access method can be specified in /.git/config using either a full URL or an SCP-like syntax, as specified in http://git-scm.com/docs/git-clone:

    URL style:

    url = ssh://[user@]host.xz[:port]/path/to/repo.git/
    

    SCP style:

    url = [user@]host.xz:path/to/repo.git/
    

    Notice that the SCP style does not allow a direct port change, relying instead on an ssh_config host definition in your ~/.ssh/config such as:

    Host my_git_host
    HostName git.some.host.org
    Port 24589
    User not_a_root_user
    

    Then you can test in a shell with:

    ssh my_git_host
    

    and alter your SCP-style URI in /.git/config as:

    url = my_git_host:path/to/repo.git/
    

提交回复
热议问题