背景:私自搭建了Git服务器,而Git本身就是SSH进行连接的,而Git命令上默认只能通过22端口实现。

解决方法:

第一种:

在系统的用户目录下的文件夹:.ssh

如果该路径下没有config文件,则创建一个。

config中添加如下内容:

如是以域名访问的则添加如下内容:(注意修改xxx为你的远程仓库的名称)

Host xxx
HostName xxx.com
Port 3333

如是以IP访问的,则添加如下内容:(注意修改IP为你的远程仓库IP)

Host "211.111.xx.xxx"
Port 3333

第二种:

Git本身基于SSH的,所以直接使用SSH的写法来增加自定义端口号

git clone ssh://git@domain.com:3022/~/Projects/p1.git

参考:

http://blog.csdn.net/u010041075/article/details/52981731

http://blog.csdn.net/daiwood/article/details/50561306

Git配置非22端口,解决:ssh: connect to host xxx port 22: Connection timed out fatal: The remote end hung up unexpectedly的更多相关文章

  1. 新手git: ssh: connect to host localhost port 22: Connection refused

    由于gitlab上要git pull或者git clone,可是每次都出现这个问题.之前偶尔出现这个问题.可是仅仅是偶尔.这是为什么呢?然后就開始搜索网上的解决方式了. 这个问题搜索网上非常多答案.可 ...

  2. ssh本机失败(ssh: connect to host localhost port 22: Connection refused)

    ssh本机失败(ssh: connect to host localhost port 22: Connection refused) 一. 问题描述 之前一直在服务上使用宝塔面板, 今天突发奇想, ...

  3. 运行Hadoop start-all.sh遇到的错误ssh: connect to host localhost port 22: Connection refused

    ssh: connect to host localhost port 22: Connection refused 我的情况是ssh server没装,查看方法: ps -e |grep ssh 1 ...

  4. ssh: connect to host localhost port 22: Connection refused

    1.hadoop安装好之后,执行ssh localhost无法执行, 提示“ssh: connect to host localhost port 22: Connection refused”. 2 ...

  5. Ubuntu下 ssh : connect to host localhost port 22:Connection refused

    Ubuntu下测试ssh时使用ssh localhost 命令,出现错误提示connect to host localhost port 22:Connection refused 造成这个错误的原因 ...

  6. ssh: connect to host master port 22: Connection refused

    hadoop集群启动的时候namenode显示Connection refused 到windows下ping  master 显示传输中过期 ip是静态的 ssh master 也是连接拒绝 重启s ...

  7. 解决osx下 ssh: connect to host localhost port 22: Connection refused

    解决办法: 终端下执行:sudo  systmesetup -setremotelogin on

  8. <Linux> Ubuntu error: ssh: connect to host master port 22: No route to host lost connection

    iptables当找到匹配的规则时,就会执行相应的动作,而不会向下继续匹配.因为ssh端口开放的规则在all规则之后,所以永远都不会匹配到,也就是ssh永远被禁止. root下执行:iptables  ...

  9. 使用ssh localhost命令,发生异常ssh: connect to host localhost port 22: Connection refused

    使用"ssh localhost"命令,失败: 问题分析如下: 出现这个问题是因为Ubuntu默认没有安装openssh-server.检查是否安装了openssh-server, ...

随机推荐

  1. 64_p1

    PEGTL-devel-1.3.1-2.fc26.i686.rpm 13-Feb-2017 22:10 64086 PEGTL-devel-1.3.1-2.fc26.x86_64.rpm 13-Feb ...

  2. PXC加入新节点避免SST时grastate.dat文件内容的修改问题

    PXC加入新节点避免SST时grastate.dat文件内容的修改问题 在主从同步完成并关闭实例后,需要修改grastate.dat中的seqno:到底应该填已经执行过最后的XID号(Executed ...

  3. FileZilla 配置备份与还原【转】

    FileZilla是一款免费开源的FTP软件,安装和配置都很简单.在安装目录下的FileZilla Server Interface.xml和FileZilla Server.xml两个文件是程序的配 ...

  4. juey点击tr选中里面的radio

    //点击一行选中银行卡 $("tr").bind("click",function(){ $("input:radio").attr(&qu ...

  5. 关于一些对location认识的误区

    1. location 的匹配顺序是“先匹配正则,再匹配普通”. 矫正: location 的匹配顺序其实是“先匹配普通,再匹配正则”.我这么说,大家一定会反驳我,因为按“先匹配普通,再匹配正则”解释 ...

  6. PHP laravel 5.0 Blade 模板引擎 Api使用备注

    PHP laravel 5.0 Blade 模板引擎 Api使用备注 /** * PHP laravel 5.0 Blade 模板引擎 Api使用备注 **/ //子模版中开头,调用@extends( ...

  7. linux抓包工具tcpdump基本使用

    tcpdump 是一款灵活.功能强大的抓包工具,能有效地帮助排查网络故障问题. tcpdump 是一个命令行实用工具,允许你抓取和分析经过系统的流量数据包.它通常被用作于网络故障分析工具以及安全工具. ...

  8. Windows内核分析——内核调试机制的实现(NtCreateDebugObject、DbgkpPostFakeProcessCreateMessages、DbgkpPostFakeThreadMessages分析)

    本文主要分析内核中与调试相关的几个内核函数. 首先是NtCreateDebugObject函数,用于创建一个内核调试对象,分析程序可知,其实只是一层对ObCreateObject的封装,并初始化一些结 ...

  9. MySql学习笔记——触发器

    今天又学习了一下mysql触发器的相关知识,对此做了一些笔记和总结. 定义及作用 触发器是一个被指定关联到一个表的数据对象,触发器不需要调用,当对一个表的特别事件出现时,它就会被激活.触发器的代码也是 ...

  10. 洛谷P1615 西游记公司 题解

    题目传送门 这道题题面写得非常好. 但好像并没有什么ruan用. 这道题貌似就是把时间差求出来,乘上猪八戒能偷的电脑数就好了.(注意long long) #include<bits/stdc++ ...