小弟由于跨平台开发需求,需要在不同平台调试代码。最近自己用RedHat6.4内置的git搭建了私有git服务器,通过ssh key提交代码。
服务器搭建好后,使用git clone git@192.168.2.20:data/test.git
进行第一次同步。Linux客户端一次成功,Windows却报错:
fatal:Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Linux客户端是Redhat6.4预装的,Windows客户端用的gitExtensions。
小弟不知道问题出在哪里?
使用ssh git@192.168.2.20
可以直接免密码登陆的,所以排除ssh的问题。照理说Windows下的git也是Git bash,命令都一样,为什么windows不能用。
补充一下:windows 版本win7.
刚刚在Windows的Git bash里用git remote -v
查看了一下远程库,是正确的显示:
origin git@192.168.2.20:data/test.git (fetch)
origin git@192.168.2.20:data/test.git (push)
那么现在问题是否仅仅是:连接/添加远程库成功,但是不能clone,目录/文件权限问题?
Thank you everyone for your answers. I have found the root cause.
Solution: Since Linux works but Windows does not work, then look for the differences between the git clients of the two systems.
After investigation, I finally learned that the ssh client of the Windows git client uses putty by default, so I manually changed it to OpenSSH, which is consistent with the Linux client. problem solved.
Using
git remote -v
only displays the remote server information configured in the current git repository, and does not mean that the remote code base can be accessed in git bash in Windows.You said that you can access the code library under Linux. Is it accessed in your Redhat6.4? So I make a bold guess:
So, I suggest you:
This should solve the problem
Since it is ssh, then the question is, has your server configured ssh, has your client generated ssh-key, and has the public key been saved to the server? Is the IP accessible?
Check these questions one by one.