5
votes

I am new to Git (just started 2 days ago). I'm attempting to create a project to practice the basic commands I've learned from here.

Where I am, so far:

  • [success] Create a new public git project (because I tried private and internal before but I could not clone it, and I don't know why). Here it is.
  • Added a README.md into the project.
  • [success] Create a new branch named develop.
  • [success] In my local folder C:\gitprojects, set global user.name and user.email with the commands:

    • git config --global user.name <my user name>
    • git config --global user.email <my-email>
  • [success] Clone the project into my local folder C:\gitprojects with the command git clone https://[email protected]/flamedenise19/speedtyping.git

  • [success] Create a local branch with the command git checkout -b "develop".
  • [success] Manually add a new file test.txt on local root folder for test pushing.
  • [success] Commit the new file with the command git commit -m "adds test.txt"
  • [attempting] Push the commit with the command git push origin develop

And now, I'm stuck with the push part. After entering git push origin develop, a new window pops up, asking for my credentials (see screenshot below):

enter image description here

So I did enter my credentials (the very same username and password I use when logging in to gitlab.com), but after that, I got this error (also see screenshot below):

remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab.com/flamedenise19/speedtyping.git/'

enter image description here

QUESTIONS:

  • Why can't I push successfully, even with the correct username and password? Am I missing something or have I done something wrong along the way?
  • Is there a way to remove the step of having to enter my credentials everytime I push something?

Please help.

NOTE: I have seen THIS ONE, and the answers are mentioning Tortoise. Is it always required to use tortoise in order to use Git?

SOME BACKGROUND INFO:

Two-Factor Authentication is disabled for my account (see screenshot below):

enter image description here

3
are u enter gitlab authentication ? - Gohel Dhaval
Also, if you didn't create a project from the dashboard, it would be rejected too. - Tatsuyuki Ishi
@TatsuyukiIshi which dashboard are you referring to? I created the project in gitlab.com/projects/new itself (by clicking that " + " icon on the left of my profile image), and then cloned it in my local. Is this a wrong way to create a project? - ITWitch

3 Answers

2
votes

These are my ideas:

  • Try if it works on the Git Bash
  • Have you added a ssh key to your account? If yes remove it and try again. If not add one and try the ssh url.
  • You don't necessarily need Tortoise Git but it may also work around your problem
  • Try to re-install Git without the Git Credential Manager for Windows

When you've fixed the push problem you will also be able to clone it when it is private or internal.

2
votes

After doing some digging of my own thanks to this problem I found out that it is more than likely coming from the credential manager. I had no ssh keys since it was a fresh Gitlab account and it was not working with my username and password. The same setup however, was working on GitHub. After uninstalling git and reinstalling without the credential manager it worked.

2
votes

If it is on windows, go to Credential Manager, Windows Credentials and Delete the entries under Generic Credentials.

Try connecting again. This time, it should prompt you for the correct username and password.