新项目开始前,我提议版本控制用git(弃用SVN)。领导说可以,但要在公司服务器上自己装git服务器。给我的服务器ssh连接端口公司统一改用其他端口。安装成功后,设置了远程仓库地址,提交时出现:
ssh: connect to host 192.168.x.xxx port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
网上查了一下,前20个帖子内容几乎一模一样,可恶的CSDN。
后来得一大神指点,提交成功。
如下添加远程地址的命令执行之后,提交项目报错。
git remote add origin xxx@192.168.x.xxx:xxxx/xx/xx/xxx.git
大神指点后的命令前面加了协议,如下:
git remote add origin ssh://xxx@192.168.x.xxx:xxxx/xx/xx/xxx.git
其实就是在远程仓库地址前面加了ssh://协议。