最详细的git配置端口号,多个gitlab间随意用

修改~/.ssh/config文件如下,没有这个文件的就新建吧
host github
user git
hostname git.github_test.com
Port 6000
identityfile ~/.ssh/id_rsa(可省略,默认是一样的,除非你不同服务器用不同密钥)
使用时候git clone git@ github:u-boot/u-boot-xlnx.git就会自动使用6000端口访问。
注意两点:
  • id_rsa*公私钥不区分账户的,但是要改所属和权限,比如root用户生成的密钥可以直接拷贝到~/任何账户,更改chown user:user然后chmod 600权限就可以了,包括.ssh和config的所属权user有权访问即可。
  • 使用的时候git(命令) clone(参数) git(config/user)@github(config/host):具体的工程名称.git

为了习惯我还是把config里面的host名称改成hostname一样, user一般都是git,以上config内容纯属举例,根据自己实际的服务器和端口来配置,如下
h ost github.com
user git
hostname github.com
Port 22
identityfile ~/.ssh/id_rsa

用起来习惯一些git clone [email protected]:u-boot/u-boot-xlnx.git


你可能感兴趣的:(软件使用)