2
votes

When I am trying to upload my code to github. Below are the steps which I executed in GitBash terminal. While trying to push the code to github using $git push -u origin main the cursor moved to next line and keeps blinking but does nothing.

git remote add origin "https://github.com/TarunRajinikanth/Trifacta.git"
git add -A 
git config --global -user.name "username"
git config --global -user.email "[email protected]"
git commit -m "this is my first commit"
git branch -m main
git push -u origin main

enter image description here

4
Nothing to do with cygwin. Let us wait for the OP's feedback before closing a question.VonC
No, it's mingw64 that's the problem.matt
@matt Apparently more the latest Git coupled with the lasted GCM (Git Credential Manager). I have edited the answer with the relevant issue references.VonC
Excellent, thanks! I'll make this my canonical link.matt

4 Answers

5
votes

Update July 2021:

Git for Windows 2.32.0(2) does include GCM (Git Credential Manager Core) v2.0.475.64295, which should solve the issue/PR 374 ("Fix bug where GUI prompts would not be shown on Windows").


Original answer (June 2021):

Check your git config credential.helper to see if a caching mechanism would be the issue.

You should:

  • double-check our %PATH% (before opening a git bash), in order to reference C:\Program Files\Git\mingw64\libexec\git-core,
  • double-check what is stored in the Windows Credential Manager

you do that with:

 printf "host=github.com\nprotocol=https"|git-credential-manager get

If you see the wrong password, remove it with:

printf "host=github.com\nprotocol=https"|git-credential-manager erase

Repeat the erase command until you see a popup (do not enter your credentials then)

Then repeat your git push -u origin main, and enter your credentials to store them.

Note that git-for-windows/git issue 3268 points to microsoft/Git-Credential-Manager-Core issue 364.

As a temporary workaround:

git config --global credential.provider generic

Note that microsoft/Git-Credential-Manager-Core v2.0.475 has just been released to fix issue 364 with PR 375, in the context of Git 2.32 (May 2021).
The latest snapshot of Git for Windows should include that fix.

1
votes

I too had the same problem, I managed to solve it after hours of work. Now I share with you how I managed it 🙂. I found two methods to solve this problem, I hope at least one of them works for you! But before I explain the solution that worked for me, I'll explain step by step what the problem is:

IF EVERYTHING WORKED:
If everything worked (as it should), after running the command:
git push -u origin main
a new small window would appear for entering the GitHub username and password, this is because basically Git asks GitHub for permission to make changes. This "window" is the Credential Helper.

CAUSE OF THE PROBLEM:
So the problem you're experiencing is due to an authentication issue.
This problem mainly occurs when you install Git:
we all tend to click on the "next" button to leave the default settings unchanged, without paying much attention to what is being asked of us. During Git installation, in fact, we are asked to choose the "Credential Helper"! During the installation of the latest version of Git, there is a default setting that didn't work for me at all. So I'm inclined to think that those who install the new version of Git may run into this problem (probably for Windows users).

SOLUTIONS:

  • 1. First Method
    Uninstall Git: I know it's a hassle because you have to reconfigure everything but if you want to avoid uninstalling Git then I suggest you skip this method and look at the second method.
    So I repeat, uninstall Git. When you reinstall it, be especially careful when it asks you to choose the Credential Helper. Change the default setting, choose "Git Credential Manager", as you can see from the picture:  click here to see the photo
    (in fact, if you notice, it says that it handles credentials for GitHub)
    Continue with the installation. Now your problem should not occur again.
  • 2. Second Method
    To solve the problem, another method is to run the following command:
    git config remote.origin.url https://USERNAME:[email protected]/USERNAME/REPONAME.git
    In this way, you would not only solve the problem without the help of the Credential Helper, but you would also save your Github username and password on Git: this way you would no longer need to enter your username and password every time you need to save your code on Github. That is why I integrated both methods for my problem.
  • Other methods??
    There will probably be other methods to solve the same problem. If you're using windows, one of these might be to open the Credential Manager on Windows (search by typing this name into the search bar) and from there somehow enter your GitHub username and password. This is a way that I have not followed honestly, that I discovered late and I do not know if it works or not, I wanted to share it with you anyway.

I hope I have been of help to some of you. 🙂

0
votes

I believe there is a bug in the latest version (2.32) try to downgrade git to this version (2.30.x) this is the link to download git 2.30.2

0
votes

Tried both the 1st and 2nd methods. Unsuccessful. However, after reinstalling, I restarted the computer and after starting, Git installed some restore/addition. After that, a pop-up window appeared - I passed the verification and everything worked out. After that, a letter came to the e-mail: A first-party GitHub OAuth application (Git Credential Manager) with gist, repo, and workflow scopes was recently authorized to access your account. Visit https://github.com/settings/connections/applications/0120e057bd645470c1ed for more information. In the end, I achieved my goal. Then it should be easier.