我找了一段时间,但我找不到解决我的问题的方法。
我有一个可以通过用户名git
和本地git存储库连接到的服务器。
现在我想将本地存储库推送到新创建的服务器上的存储库。
这是我所做的:
- 在
/home/git/test.git
中创建了一个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 服务器。
我可以使用 git
用户登录 ssh。
我也尝试使用相同的结果以 root
用户身份运行它(为了让事情一次性解决)。
我从未被要求输入 ssh password
。
我真的不知道我做错了什么。
在您将其称为重复内容之前,我为此问题进行了大量搜索,但似乎没有人谈论相同的问题。
更新:
- "which git" 返回 /usr/bin/git
- PATH echo 包括 /usr/bin
- id_rsa 和 id_rsa.pub 文件都已设置好并且没有 Passphrase
- 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'\''' fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Authentication refused: bad ownership or modes for directory /home/data/users/okopp
。 - koppor