使用 Eclipse EGit 在 1and1 共​​享 Linux 服务器中克隆 1and1 git 存储库时出现问题

发布于 2024-12-03 09:58:03 字数 1505 浏览 3 评论 0原文

我刚刚在我的 1and1 共​​享主机中设置了一个 git 存储库。 1and1 提供 git 作为 Linux 业务包的一部分,我决定使用它而不是安装我自己的 git。

当我执行 dir .git 时,我可以看到存储库内的信息:

-rw-r--r--   1 foo ftpusers      23 Sep  6 19:41 HEAD
drwxr-xr-x   2 foo ftpusers       6 Sep  6 19:41 branches
-rw-r--r--   1 foo ftpusers      92 Sep  6 20:42 config
-rw-r--r--   1 foo ftpusers      73 Sep  6 19:41 description
drwxr-xr-x   2 foo ftpusers    4096 Sep  6 19:41 hooks
-rw-r--r--   1 foo ftpusers 1038768 Sep  6 19:41 index
drwxr-xr-x   2 foo ftpusers      20 Sep  6 19:41 info
drwxr-xr-x 260 foo ftpusers    8192 Sep  6 19:41 objects
drwxr-xr-x   4 foo ftpusers      29 Sep  6 19:41 refs

我的存储库位于 /project (1and1 的完整路径是 /homepages/foo/bar/htdocs/project)

当我尝试使用 Eclipse EGit 访问它时,它说存储库似乎是空的。请参阅下面我到目前为止所做的尝试:

Protocol: SSH
Port: 22
Host: example.com
Repository path: project

Error Message:
Cannot list available branches.
Reason: ssh://<username>@example.com:22/project: fatal '/project'
does not appear to be a git repository.

然后我尝试更改存储库路径:

Repository path: project/.git

Same error

然后我决定尝试使用服务器中的完整路径:

Repository path: /homepages/foo/bar/htdocs/project/.git

New error: Source Git Repository is empty

所以它似乎找到了 git 存储库。但它显示为空。

顺便说一下,请参阅下面我用来在我的共享 1and1 帐户中创建 git 存储库的命令:

来自我的帐户根:

mkdir project
cd project
cp -r ../example/* .
git init
git add .

任何帮助表示感谢。谢谢。

I have just setup a git repository in my 1and1 shared hosting. 1and1 offers git as part of the Linux business package and I decided to use it instead of installing my own git.

When I do dir .git I can see the information inside the repository:

-rw-r--r--   1 foo ftpusers      23 Sep  6 19:41 HEAD
drwxr-xr-x   2 foo ftpusers       6 Sep  6 19:41 branches
-rw-r--r--   1 foo ftpusers      92 Sep  6 20:42 config
-rw-r--r--   1 foo ftpusers      73 Sep  6 19:41 description
drwxr-xr-x   2 foo ftpusers    4096 Sep  6 19:41 hooks
-rw-r--r--   1 foo ftpusers 1038768 Sep  6 19:41 index
drwxr-xr-x   2 foo ftpusers      20 Sep  6 19:41 info
drwxr-xr-x 260 foo ftpusers    8192 Sep  6 19:41 objects
drwxr-xr-x   4 foo ftpusers      29 Sep  6 19:41 refs

My repository is located at /project (full path at 1and1 is /homepages/foo/bar/htdocs/project)

When I try to access it using Eclipse EGit it says that the repository appears to be empty. See below what I have attempted so far:

Protocol: SSH
Port: 22
Host: example.com
Repository path: project

Error Message:
Cannot list available branches.
Reason: ssh://<username>@example.com:22/project: fatal '/project'
does not appear to be a git repository.

Then I tried changing the repository path:

Repository path: project/.git

Same error

Then I decided to try with the full path in my server:

Repository path: /homepages/foo/bar/htdocs/project/.git

New error: Source Git Repository is empty

So it seems that it finds the git repository. However it is showing as empty.

By the way, see below the commands I used to create the git repository in my shared 1and1 account:

from my account root:

mkdir project
cd project
cp -r ../example/* .
git init
git add .

Any help appreciated. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

故人如初 2024-12-10 09:58:03

我不确定您是否仍然遇到“似乎不是 git 存储库”的问题。问题。

我遇到了同样的问题,我找到了一个解决方案,而无需输入整个“pwd”网址。

看起来,当您远程使用 ssh 命令进入 1and1 时,它们并不是从您帐户的主目录运行(这很奇怪)。您可以像这样强制从主目录开始查找。

ssh://<username>@example.com:22/~/project

注意“~”。这将在 1and1 中的基本路径下查找项目。

我希望这有帮助。

I am not sure if you are still having issues with the "does not appear to be a git repository." issue.

I ran into the same problem and I found a solution without having to type out the entire 'pwd' url.

It appears that when you use ssh commands remotely into 1and1, they are not being run from your account's home directory (which is strange). You can force the lookup to start from your home directory like this.

ssh://<username>@example.com:22/~/project

Notice the '~'. This will look for the project under your base path in 1and1.

I hope this helps.

风吹过旳痕迹 2024-12-10 09:58:03

存储库中命令行的 git log 结果是什么?您看到的文件是使用 git init 创建的,并不意味着实际上已经提交了某些内容。您似乎已暂存文件但未提交它们。这是一个相当常见的错误,因为大多数其他版本控制系统没有类似的步骤。一旦你开始使用它来构建补丁(例如使用 git add -p ),它的价值是无价的。

一些关于 git 入门的资源:

progit 是一本优秀的书籍,可以免费在线获取。它是由 github 的创始人之一编写的。

git 社区书籍 是另一本关于 git 的在线书籍。它和 progit 之间有很多重叠,但它对某些事物进行了更深入的研究(例如它对树状结构的描述)。

What is the result of a git log from the command line in the repository? The files you see are created with git init and do not mean something has actually been committed. It appears that you have staged files but not committed them. It's a fairly common mistake since most other Version Control Systems don't have an analogous step. Once you start using it to build patches (using git add -p for example) it's invaluable.

Some resources for getting started with git:

progit is an excellent book that is freely available online. It's written by one of the founders of github.

The git community book is another online book on git. There is a lot of overlap between it and progit but it goes more in depth with certain things (such as its description of treeishes).

阿楠 2024-12-10 09:58:03

我刚刚使用 Aptana Studio 3 遇到了同样的问题。

使用

ssh://[email protected]/~/gitrepository

为我解决了这个问题(使用 1&1,替换了明显的问题)。

I just ran across the same problem using Aptana Studio 3.

Using

ssh://[email protected]/~/gitrepository

solved it for me (Using 1&1, replacing the obvious).

眼波传意 2024-12-10 09:58:03

我在 Mac 上使用 Git Tower 时也遇到了同样的问题。我终于搞定了......

ssh://[email protected]/~/repository.git

这有点奇怪,因为如果我通过 ssh 登录,我会被重定向到主目录,而repository.git就在“那里”。

但现在可以了!

I had the same problem with Git Tower on the Mac. I finally got it going with ...

ssh://[email protected]/~/repository.git

This is kind of strange because if I login via ssh, I get redirected to the home directory and the repository.git is right 'there'.

But now it works!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文