CentOS:Git:“致命:无法从远程存储库读取” [英] CentOS: Git: "fatal: could not read from the remote repository"

查看:226
本文介绍了CentOS:Git:“致命:无法从远程存储库读取”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(我已经通读了这篇文章以及其他几篇文章,完全 git:致命:无法从远程存储库中读取

( I have already read through this, and several other posts, thoroughly git: fatal: Could not read from remote repository )

我正在使用自己的服务器作为git服务器。我根据一些指南进行设置。除了读取或写入远程git存储库的任何操作外,其他所有内容都很好。

I'm using my own server as a git server. I set it up according to several guides. Everything is fine except any operation that read or writes to the remote git repository.

问题:

当我尝试时执行与已设置的远程服务器交互的任何操作,都会得到:

When I try to do anything that interacts with the remote server that I have set up, I get:


致命:

fatal: Could not read from remote repository.

请确保您具有正确的访问权限,并且存储库
存在。

Please make sure you have the correct access rights and the repository exists.

在Windows Shell中。

in windows shell. In Cygwin it just hangs.

快速背景:

我正在使用CentOS 7作为服务器和Windows 10

I'm using CentOS 7 as the server and Windows 10 as the client.

在服务器上:


  • 我创建了一个新用户'git'

  • I made a new user 'git'

mkdir /home/git/myproject.git

mkdir /home/git/myproject.git

git init --bare

git init --bare

打开了必要的端口9418、22和& 443使用:

opened up necessary ports 9418, 22, & 443 using:

firewall-cmd --permanent --add-port = 22 / tcp和

"firewall-cmd --permanent --add-port=22/tcp" and

防火墙-cmd --reload

"firewall-cmd --reload"

客户端:


  • 创建了一个文件夹,创建了一个包含一些文本的文本文件,并运行了 git init, git add。

  • 根据一些指南设置rsa密钥

有效方式:

我可以使用Windows Shell,cygwin和puTTy将服务器连接到服务器。文件夹/home/git/mproject.git存在。 git使用Windows Shell或Cygwin在本地运行良好。

I can ssh into the server fine with windows shell, cygwin and puTTy. The folder /home/git/mproject.git exists. git has been working fine locally using either windows shell or Cygwin.

尝试的解决方案:

我已经尝试过:

chmod 600 pyproject.git
chmod 700 pyproject.git
chmod 777 pyproject.git
git remote add origin git@my-site.com:/home/git/myproject.git
git remote add origin git@my-site:/home/git/myproject.git
git remote add origin ssh://git@my-site.com/home/git/myproject.git
git remote add origin ssh://git@my-site.com/repo-<wbr< a="">>/home/git/myproject.git..git
git remote add origin ssh://git@my-site.com/repo-<wbr< a="">>/home/git/myproject.git
git remote add origin git@my-site.com:/home/git/myproject.git
git clone git@my-site.com:/home/git/myproject.git
git remote add origin https://git@my-site.com/home/git/myproject.git
git clone ssh://git@my-site.com/home/git/myproject.git
git clone ssh://git@my-site.com/myproject.git
git clone https://git@my-site.com:myproject.git
git clone ssh://git@my-site.com/home/git/myproject.git
git clone git@my-site.com/home/git/myproject.git
git clone git@my-site.com:/home/git/myproject.git
git clone git@my-site.com/myproject.git

我可以用ssh git@my-site.com登录服务器。我也可以导航到/home/git/myproject.git文件夹。端口是开放的。

I can log into the server with ssh git@my-site.com just fine. I can also navigate to the /home/git/myproject.git folder. The ports are open. What else could be wrong?

推荐答案

所以问题似乎一直是客户端和客户端服务器使用的git版本差异很大。我相信客户端使用的是1.9,而服务器使用的是2.6。不仅如此,git版本因我使用的是Windows终端还是Cygwin而有所不同。

So the problem seems to have been that the client and the server were using versions of git that were very different. The client was using 1.9 I believe, and the server was using 2.6. Not only that, the versions of git differed depending on the whether I was using windows terminal or Cygwin.

现在,在删除旧版本并更新git之后,命令如下:

Now, after removing old versions and updating git, commands like:

git remote add origin git@mysite.com:/home/git/myproject.git
git push origin master

工作正常。

这篇关于CentOS:Git:“致命:无法从远程存储库读取”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆