1

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?

Dan Nissenbaum
  • 13,558
  • 21
  • 105
  • 181
MikeyJ
  • 454
  • 1
  • 5
  • 16
  • Are you able to push to your repository in command line? – Ami Oct 16 '12 at 08:35
  • I don't seem to get any error when I try to push to the github repository using git bash, but it doesn't push it up, instead it just sits as if it is running the command and wont let me do anything. – MikeyJ Oct 16 '12 at 09:54
  • Did you get any error or exceptions while trying to push it using running command? – Ami Oct 16 '12 at 09:55
  • It has just come through with an error 'error:Failed to connect to github.com:---; No error while accessing http://github.com/------/----.git/info/refs fatal: http request failed – MikeyJ Oct 16 '12 at 10:00
  • also when using ssh I get this error in command: ssh: connect to host github.com port 22: bad file number fatal: the remote end hung up unexpectedly – MikeyJ Oct 16 '12 at 13:40

3 Answers3

1

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!

MikeyJ
  • 454
  • 1
  • 5
  • 16
1

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

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.

Community
  • 1
  • 1
Bananeweizen
  • 21,797
  • 8
  • 68
  • 88