配置和连接到远程 Git 存储库时出现问题
我正在尝试在远程服务器上正确设置我的 Git 存储库,以便我可以从计算机上的本地存储库进行推送。我在 CentOS 服务器上安装了 Git 和 Redmine,这样我就可以托管自己的代码存储库。不幸的是,我的整个项目一开始有点混乱,因为它最初是一个测试,看看我能多么容易地设置这个服务,但在终于让Redmine工作之后,我想看看我是否可以使其正常运行,而无需从头开始。
在我的服务器上,我在 /public_html/redmine/ 安装了 Redmine,但是由于我在 cPanel 中创建了这个帐户,所以我进入并编辑了我的 Apache VirtualHost 条目,以便 /public_html/redmine/public/ 是我的文档根目录,这样 Redmine 就会出现。是的,如果我必须重来一次,我会以不同的方式安装。
不管怎样,现在我已经在我的 Windows 7 机器上安装了 Git,并且能够使用 TortoiseGit 在我的 VS 项目文件夹中创建一个存储库。我正在尝试使用 Git 扩展来管理我的存储库以及我的服务器上的存储库,但我似乎无法正确配置远程连接。我知道该存储库可以在服务器上运行,因为它在 Redmine 中正确显示。
我的问题是我无法准确地弄清楚我的问题出在哪里。我不知道这是否是我尝试连接到服务器的方式,或者我的服务器或远程存储库是否配置不正确。我的 git_repo 文件夹当前位于 /redmine/public/ 中。我尝试过使用 Git 扩展和命令行中的 GUI 远程存储库功能,按照许多地方的说明进行操作,但遇到了各种错误,都说我无法连接。
我真的很感激任何试图解决这个问题的帮助,因为我整天盯着我的电脑试图启动和运行它,这让我严重疲惫不堪。
作为起点:
在 Git 扩展中,我输入 user@hostname:redmine/public/git_repo/project/.git (就像说明一样),然后我得到:
“Fetching origin 完毕 fatal:远端意外挂断 错误:无法获取原点”
这是我在所有不同尝试中遇到的最常见错误。
I am trying to properly set up my Git repositories on a remote server so that I can push from my local repositories on my computer. I installed Git and Redmine on my CentOS server so that I could host my own code repositories. Unfortunately this entire project of mine started out a bit messy because it was originally a test to see how easily I could get this service set up, but after finally getting Redmine working, I wanted to see if I could get it functional without having to start over from scratch.
On my server, I have Redmine installed at /public_html/redmine/, but since I created this account in cPanel, I went in and edited my Apache VirtualHost entry so that /public_html/redmine/public/ is my document root so that Redmine would show up. Yes, I would have installed differently if I had to do it over again.
Anyway, now I have Git installed on my Windows 7 box and am able to use TortoiseGit to create a repository in my VS project folder. I am trying to use Git Extensions to manage my repositories here, as well as on my server, but I cannot seem to get the remote connection configured correctly. I know the repository works on the server because it shows properly in Redmine.
My problem is that I cannot figure out exactly where my problem is. I do not know if it is how I am trying to connect to the server, or if my server or remote repository is not configured correctly. My git_repo folder is currently in /redmine/public/. I have tried using the GUI remote repository function in Git Extensions and the command line, following the instructions in numerous places, and have gotten all sorts of errors all saying I cannot connect.
I would really appreciate any help trying to troubleshoot this as I am seriously burned out from staring at my computer all day trying to get this up and running.
Just as a starting point:
In Git Extensions, I enter user@hostname:redmine/public/git_repo/project/.git (just like the instructions) and I get:
"Fetching origin
Done
fatal: The remote end hung up unexpectedly
error: Could not fetch origin"
That is the most common error I get with all of my different attempts.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
步骤 1. 忘记使用 git 扩展。从命令行使用 msysgit。您会更容易看到发生了什么。
步骤 2. 在两台计算机上设置 ssh 密钥。创建密钥时不要使用密码。在 ssh-keygen 上添加 -t rsa 选项。
当您从命令行使用裸 msysgit 克隆存储库时,请返回此处报告。
我已经愉快地使用 MSysGit 多年了,从来不需要使用 git 扩展。
Step 1. Forget about using git extensions. Use msysgit from the command line. It will be easier for you to see what's going on.
Step 2. Set up ssh keys on both machines. Don't use a password when creating the key. add the -t rsa option on ssh-keygen.
Report back here when you have cloned your repository using bare msysgit from the command line.
I've been happily using MSysGit for a number of years now and never needed to go to git extensions.