git clone using http – repository not found [solved]

When trying to clone a git repository on my server using http protocol, following error was thrown though I could clearly access .git folder via any web browser.

fatal: repository ‘http://<hostname>/path/to/project/folder/’ not found

Steps to correct this error:

  1. log into your git remote server
  2. navigate to your project folder
  3. run
    git update-server-info

On client side, when running git clone instruction, type in path up to .git folder. That means in case repository was not create as bare repository, run:

git clone http://<hostname>/path/to/project/folder/.git

This time it should be successful.

note: it is recommended to create a bare git repository, instead of regular repository, on server side when remote folder will act as central repository for all clients (i.e. where no direct modification will be performed, everything gets updated via commits)

Publishing to git repository

When publishing to remote repository, following error may occur:

error: Cannot access URL http://www.example.com/git/projects/example/, return code 22

In that case, move to project folder on server side and run:

git config http.receivepack true

sources

 

Post a Comment

Your email is never published nor shared. You're allow to say what you want...