29

I did commit successfully in my local repository. When I try to do:

git push https://gitlab.com/priceinsight/jmt4manager/compare/develop...2-retrieve-list-userrecord# 2-retrieve-list-userrecord -v

I got this error:

Pushing to https://gitlab.com/priceinsight/jmt4manager/compare/develop...2-retrieve-list-userrecord#
fatal: unable to update url base from redirection:
  asked for: https://gitlab.com/priceinsight/jmt4manager/compare/develop...2-retrieve-list-userrecord#/info/refs?service=git-receive-pack
   redirect: https://gitlab.com/users/sign_in
Vampire
  • 35,631
  • 4
  • 76
  • 102
Vyacheslav
  • 413
  • 2
  • 5
  • 8

4 Answers4

29

The URL you try to push to is not correct. You are trying to push to the URL https://gitlab.com/priceinsight/jmt4manager/compare/develop...2-retrieve-list-userrecord# which is a webpage that compares two branches and not the URL of a repository. The repository would be https://gitlab.com/priceinsight/jmt4manager.

Vampire
  • 35,631
  • 4
  • 76
  • 102
  • 1
    My URL was total nonsense as you suggested here. I discovered if I went to the URL it had the valid git clone URL in it. – micahhoover Oct 30 '20 at 12:55
17

I understand that your answer was already solved, but I had a very similar issue myself with a nonsense URL. The actual issue for me was that I had not logged into the company internet yet, so git was being redirected somehow through some sort of internet login page, and failing to go through.

The fix in this case is simple: just login in a separate browser before trying to git push your changes.

NoseKnowsAll
  • 4,593
  • 2
  • 23
  • 44
4

You need to following 2 steps:

  • Remove current origin: Git remote remove origin
  • Add new origin: Git remote add origin https://...(your link to to on)
dippas
  • 58,591
  • 15
  • 114
  • 126
2

I also understand that your question was solved, but since I had a different solution and this is the top search result for the error, here's my ten cents...

I simply had the wrong repo string. In the GCP repo viewer they given you a HEAD URL that's NOT the same as the remote URI that you should use. In my case, the HEAD URL provided in the "Links" drop-down in the web console was:

https://source.cloud.google.com/[PROJECT]/[REPO]/+/master:

(of course I removed the "/+/master:" at the end)

Whereas my actual (correct, working) repo URL is:

https://source.developers.google.com/p/[PROJECT]/r/[REPO]

I got the format from this page. Not sure why this isn't one of the options in the web portal, but oh well.

Hope this helps someone else!

jetsetter
  • 517
  • 5
  • 19