我搜索了一段时间,但找不到解决问题的方法。
git
我有一个服务器,我可以使用用户名和本地 git 存储库通过 ssh 连接。
现在我想将我的本地存储库推送到服务器上新创建的存储库。
这是我所做的:
- 在中创建了一个 git 存储库
/home/git/test.git
- 将存储库初始化为裸
- 在本地机器上添加远程存储库
git remote add test ssh://git@serverIp:/home/git/test.git
- 现在我执行了推送命令:
git push test master
我总是得到
fatal: could not read from remote repository
Please make sure you have the correct access rights
and the repository exists.
我正在使用本地 Windows 7 机器并想上传到 linux 服务器。
我可以使用用户通过 ssh 登录git
。我还尝试以root
用户身份执行此操作(以使事情工作一次),结果相同。
我从来没有被要求提供 ssh password
。
我真的不知道我做错了什么。
在你称之为重复之前,我搜索了很多这个问题,但似乎没有人谈论同样的问题。
更新:
- “哪个 git”返回 /usr/bin/git
- PATH 回显包括 /usr/bin
- id_rsa 和 id_rsa.pub 文件均已设置并输入密码
- ssh git@serverIp which git-receive-pack 也可以工作并返回 /usr/bin/git-receive-pack
- ssh git@serverIp ls /home/git/test.git 有效
- 所有相关目录都是 chmod 755
- git 是存储库的所有者
- auth.log 文件在尝试推送命令时没有新条目
- GIT_TRACE=2 git push test master 返回:
'C:\Program Files (x86)\PuTTY\plink.exe' '-batch' 'git@serverIp' 'git-receive-pack '\''/home/git/test.git'\''' 致命:无法从远程存储库中读取。请确保您具有正确的访问权限并且存储库存在。