Transport error with Egit

7.8k Views Asked by At

I have set up a gitstack repo on a local server, I have also signed up for a free github account just to see what its like.

But when I try to clone a repository from either my local repository or git hub repository I get this error:

Transport Error
Cannot List the available branches
Reason:
Exception caught during execution of ls-remote command

What does this mean and how do i go about solving this problem?

3

There are 3 best solutions below

0
On BEST ANSWER

After having this problem with Egit I went back to using GitBash to try to create, push and pull repositories. I was then given this error:

Git Bash error:

fatal: http://xx.xx.x.xxx/mjtest.git/info/refs not found: did you run git update-server-info on the server?

Egit error:

Transport Error
Cannot List the available branches
Reason:
Exception caught during execution of ls-remote command

I found that the solution to both the GitBash and the Egit error was to create an empty file called git-daemon-export-okand place it directly into the xxxx.git root directory of the repository on the server.

The solution explained:

I set up a repository in gitstack called mjtest and create myself a new username and password and add myself to the repository with read and write access.

This is what I then do in GitBash:

I set up my local repo:

git config --global user.name "XXXXXXXX"
git config --global user.email XXXXXXXX
mkdir ~/mjtest
cd ~/mjtest
git init
touch README

Then I create the empty file:

touch git-daemon-export-ok

So now we have a local repository that has a file called README and our git-daemon-export-okfile in it. We now need to copy the git-daemon-export-okfile and place it directly into the mjtest.git folder in the server. Once that is done the git-daemon-export-ok file can be deleted from the local repository, as it just needs to be on the server.

Adding, Commiting and Pushing:

git add README
git commit -m 'first commit'
git remote add origin http://XX.XX.X.XXX/mjtest.git
git push origin master

This should work and you should be able to go onto your gitstack server and see your first commit.

I then went back onto Egit and cloned the http://XX.XX.X.XXX/mjtest.git repository and it worked.

Now both push and pull work in GitBash and Egit!

0
On

Please have a look at Can't clone remote git repository with EGit for several potential reasons. In cases where I had to deal with that error message, it was a wrong .ssh directory given in Eclipse or completely missing SSH keys in the ssh directory.

0
On

There is another transport-related possible error when cloning a remote repository.

Cloning from a repository that does not yet have any branches or tags but has other refs resulted in a "remote transport reported error", which has been corrected with Git 2.36 (Q2 2022).

See commit dccea60 (24 Jan 2022) by Jonathan Tan (jhowtan).
(Merged by Junio C Hamano -- gitster -- in commit d991df4, 09 Feb 2022)

clone: support unusual remote ref configurations

Signed-off-by: Jonathan Tan

When cloning a branchless and tagless but not refless remote using protocol v0 or v1, Git calls transport_fetch_refs() with an empty ref list.
This makes the clone fail with the message "remote transport reported error".

Git should have refrained from calling transport_fetch_refs(), just like it does in the case that the remote is refless.
Therefore, teach Git to do this.

In protocol v2, this does not happen because the client passes ref-prefix arguments that filter out non-branches and non-tags in the ref advertisement, making the remote appear empty.

Note that this bug concerns logic in builtin/clone.c and only affects cloning, not fetching.