2

I deleted my current development directory, cloned a new one from my online repository, and now when I try to to do a

git push origin

I receive a

error: The requested URL returned error: 401 while accessing https://gitlab.com/..../.....git/info/refs

fatal: HTTP request failed

What can be the cause? Thanks for the time.

Community
  • 1
  • 1
user2752471
  • 444
  • 1
  • 6
  • 14

1 Answers1

0

401 means

Unauthorized

The request has not been applied because it lacks valid authentication credentials for the target resource.

Check your git config credential.helper value: it is possible it caches the wrong credentials (username/password)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I entered "git config credential.helper" on the command line and nothing happened. Then tried again "git push origin" and the same problem persisted. – user2752471 Apr 14 '18 at 19:01
  • @user2752471 On what OS are you? What is your Git version? – VonC Apr 14 '18 at 19:46
  • Ubuntu 10.04, git version is 1.7.0.4 – user2752471 Apr 14 '18 at 20:49
  • @user2752471 10.04 as in 2010? (http://old-releases.ubuntu.com/releases/10.04.0/). Git 1.7.0.4 as in Sept. 2010? (https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.0.4.txt). I didn't know computers existed back then. I wasn't even born yet. Any chance to install Git 2.17 through ppa (as in https://stackoverflow.com/a/41357503/6309)? – VonC Apr 14 '18 at 20:54
  • Do you mean typing these commands? sudo add-apt-repository ppa:git-core/ppa sudo apt-get update sudo apt install git I did the first but I am afraid that if I enter the second command it will star to update everything on m system and not only git. Will it only update git? If not how can I tell apt to update only git? – user2752471 Apr 15 '18 at 15:53
  • Yes , in order to upgrade Git. – VonC Apr 15 '18 at 15:54
  • Edited the first comment, please take a look. I mean the one that you just answered to. – user2752471 Apr 15 '18 at 15:55
  • It will list the list it will update. But if this seems too much, update your repo somewhere else, on another machine where got is up-to-date, and then go back to your old Linux, and pull. They way, you avoid the push issue. – VonC Apr 15 '18 at 15:59
  • I did a sudo apt-get update and it did printed a lot of messages like: Hit http://ppa.launchpad.net lucid Release.gpg Hit http://old-releases.ubuntu.com lucid Release.gpg Ign http://old-releases.ubuntu.com/ubuntu/ lucid/main Translation-en_US ........ Hit http://old-releases.ubuntu.com lucid-security/universe Sources Hit http://old-releases.ubuntu.com lucid-security/multiverse Packages Hit http://old-releases.ubuntu.com lucid-security/multiverse Sources Hit http://ppa.launchpad.net lucid/main Packages. Then if I issue a sudo apt install git I receive: sudo: apt: command not found – user2752471 Apr 15 '18 at 16:09
  • It's apt-get, not apt – VonC Apr 15 '18 at 16:16
  • I send a "git push origin" and received: "warning: push.default is unset; its implicit value has changed in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the traditional behavior, use: .........................Username for 'https://gitlab.com':" Shall I enter my https://gitlab.com/asmf2/asmfrt.git ? Repeating the "https://gitlab.com" part? – user2752471 Apr 15 '18 at 17:10
  • A git config --global push.default simple will fix that – VonC Apr 15 '18 at 17:12
  • What you need to enter is your Gottlieb Gitlab username and password, assuming you don't have 2fa (2 factor authentication) – VonC Apr 15 '18 at 17:13
  • This is what I tried to do entered: git push -u origin...... Username for 'https://gitlab.com': https://gitlab.com/asmf2/asmfrt.git Password for 'https://https://gitlab.com/asmf2/asmfrt.git@gitlab.com': remote: HTTP Basic: Access denied fatal: Authentication failed for 'https://gitlab.com/asmf2/asmfrt.git/' I entered my password for the gitlab website. I also tried "git config --global push.default" after that and then repeated all above without success – user2752471 Apr 16 '18 at 22:09