开发者

Problems cloning 1and1 git repository in 1and1 shared Linux server with Eclipse EGit

开发者 https://www.devze.com 2023-04-03 16:27 出处:网络
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.

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 f开发者_运维问答oo 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.


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.


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).


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

Using

ssh://u1234@domain.com/~/gitrepository

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


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

ssh://username@sshuser.online.de/~/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!

0

精彩评论

暂无评论...
验证码 换一张
取 消