How to fix - unable to update URL base form redirection asked for https://github.com/rahulwagh/spring-boot-docker.git?


I faced this issue when I was trying to clone my GitHub repository but somehow I made a mistake and instead of using the correct GitHub Repository URL I used an incorrect URL.

Here are the URLs -

  1. Correct URL - https://github.com/rahulwagh/k8s-jenkins-aws.git
  2. Incorrect URL - https://github.com/rahulwagh/k8s-jenkins-aws

But the above-mentioned scenario is one of the most common mistakes a developer does while working with multiple repository projects. In this blog post, we will go through a number of different use cases and how to troubleshoot the following error-

1unable to update URL base form redirection asked for https://github.com/rahulwagh/spring-boot-docker.git 

How to fix unable to update URL base form redirection asked for ?

  1. It returns 404 because the GitHub or BitBucket repository does not exist
  2. Disable the proxy from your editor(TortoiseGit, Intellij, Eclipse, Visual Studio, etc..)
  3. The Repository URL is incorrect
  4. Re-add the origin i.e. - git remote add origin <repo_url>
  5. Are into the same network where the repository is?


1. It returns 404 because the GitHub or BitBucket repository does not exist?

Going to the basics always have closer look at the error message and if you see 404.html in your error message which means that your GitHub repository URL is not valid and someone has removed that repository hence causing 404 error.

1fatal: unable to update url base from redirection: asked for: https://github.com/rahulwagh/k8s-jenkins-aws.git/info/refs?service=git-receive-pack redirect: https://github.com/rahulwagh:/404.html`

Resolution - Check with repository owner and ask for the correct repository URL


2. Disable the proxy from your editor(TortoiseGit, Intellij, Eclipse, Visual Studio, etc..)

The second possible reason could be the network in which you are working and you are sitting behind the proxy.

Most of the time we work in corporate offices where we generally have a corporate network secured with its firewall and it is very often that you are sitting behind the proxy server, so in such cases, you can not access your repository URL and eventually you end up with the error.

To fix the error you must disable any proxy settings available in your editor.

Now a day the proxy settings are found in all most all the editors -

  1. TortoiseGit
  2. IntelliJ
  3. Eclipse
  4. Visual Studio


3. The Repository URL is incorrect

Well, this is one of the most stupid mistakes a developer can make at the end of the day and I am not an exception for that. I accidentally copied the incorrect repository URL instead of the correct one. So when I tried to clone my repository I ended up with the above error.

Note - Always check that your Repository URL end with .git

Here are my both URLs correct one as well as incorrect one -

  1. Correct URL - https://github.com/rahulwagh/k8s-jenkins-aws.git
  2. Incorrect URL - https://github.com/rahulwagh/k8s-jenkins-aws

Be vigilant when you try to pick or copy the URL.



4. Re-add the origin i.e. - git remote add origin <repo_url>

This is a little tricky to troubleshoot, if after applying Step-1, Step-2, Step-3 you are still stuck with the error then it might be possible that you are working with multiple projects with their own separate repository.

And while working with such a setup where you have multiple repository URLs then it is very common that over time you might mess up your repository setup and then you should re-attach or re-add your GitHub repository URL.

You can use the following command to add origin -

1git remote add origin <repo_url>

Repo URL - Repo URL should end with .git extension



5. Are you into the same network where the repository is?

We are developers and most of the development work we do in the corporate office network. So in case, your repository exists in the corporate network then you should always make sure that you are also in the same network so that you can access or clone your GitHub repository.

In the current time we are very often working in the remote setup where we use company-provided VPN, so in such cases, if you are disconnected from VPN then you will end up with this issue because after getting disconnected from VPN you are no longer present in the company network.

So always make sure that you are in the same network where your repository is.

Apart from that, you might also face permission denied publickey issue so read this blog post on How to fix git@github.com permission denied (publickey). fatal could not read from remote repository



References

  1. StackOverflow - fatal: unable to update url base from redirection
  2. StackOverflow - https://stackoverflow.com/questions/43835309/git-push-gives-fatal-unable-to-update-url-base-from-redirection/56567910
Anchor-17-feb-2021