jueves, 10 de noviembre de 2016

Git clone error: RPC failed; result=22, HTTP code = 500

The other day I was trying to clone a repository with no success, the errr I received was:

$ git clone https://githost/username/repository.git

error: RPC failed; result=22, HTTP code = 500
fatal: The remote end hung up unexpectedly

After a search I found that if you are pretty sure about your connection account and url the problem is with http.postBuffer. To increase the http.postBuffer you should execute the following command:

git config --global http.postBuffer 524288000


The number 524288000 could change according to your necessities.

After that you can run git clone without troubles.

How to change URL of a remote git repository

A few days ago one of our developers quit his job and we assigned the laptop to another person. All the git repositories were configured with his account, so we had to change the url for every git repository.

The process to change the repository url is very simple.

To see what is the actual repository you have to use the command git remote -v, then you will see two lines showing you the fetch url and the push url. Something like the following lines:

origin  githost:USERNAME/REPOSITORY.git (fetch)
origin  githost:USERNAME/REPOSITORY.git (push)

To change the fetch url you have to execute the following command:
git remote set-url origin githost/USERNAME/OTHERREPOSITORY.git

And to change the push url the command is:
git remote set-url --push origin githost:USERNAME/OTHERREPOSITORY.git

That is it! You changed your urls.