Fail to clone repository using ssh on Gitblit

3k Views Asked by At

I've tried to clone a repository from my gitblit server using SSH, but it showed that "fatal: could not fetch refs from ssh://server-name:29418/repo-name.git"

Here is what I've done:
1. Create a user named user1 in Gitblit server, and grant it access permission to an empty reposity named test.git.
2. On my client, usging ssh-keygen to create a key pair
3. Upload my public key to the server
4. Try remote login using ssh, and it succeed.
5. Try to clone the repository, it failed and show the error message "fatal: could not fetch refs from ssh://user1@server-name:29418/test.git".

Could anyone please tell me where I did wrong please?

1

There are 1 best solutions below

3
On

It may have actually worked - check your repo-name folder.

If you are cloning an empty repository there are no refs to fetch. There is a bug in JGit (used server-side by Gitblit) which returns an incorrect result to the native git client which causes a message like what you describe to be displayed after cloning an empty repo. If JGit returned the correct result, your native git client should have said something about cloning an empty repository.