Juan Ferrer Juan Ferrer - 3 years ago 155
Git Question

Git can't push from PowerShell

I recently updated to git v 2.14 using the Windows Installer. After that, I carried on working with my organisation's private repository as usual,

ing the files as required,
ting, etc. At the end of the day, when I went to
(from PowerShell), I received the following error:

> git push
remote: Repository not found.
fatal: repository 'https://github.com/<User>/<Repo>.git/' not found

Navigating to the mentioned URL showed my repository with all the commits that were previously there. The ones that I had done since the update had not been committed.

I then went to check on the Windows Command Prompt, receiving the same error message. Same thing happened on Git Bash.

Commands that act on the local repository (
git commit
git add
git reset
, etc.), were working fine. Other commands that require communication with the remote yield the same results. Stuff like
git fetch
git clone
show the error:

> git clone 'https://github.com/<User>/<Repo>.git'
Cloning into '<Repo>'...
remote: Repository not found.
fatal: repository 'https://github.com/<User>/<Repo>.git/' not found

I'm quite sure it's a problem in how my account is communicating with private repositories from the organisation, but I can't find a way to solve it.

Has anyone encountered this issue before? Any ideas?

Answer Source

After a while or trying different stuff, I opened the repository from Git GUI. When I tried to push, it requested my email and password (something that PowerShell would always ask for). Adding all the information, it pushed fine.

I tried again from PowerShell and received no prompt for credentials. Checking git config --global -list (as suggested by @AdilHindistan) listed credential.helper=wincred. Apparently, during the update I had left ticked the option to enable the Git Credential Manager for Windows. It had probably saved my password from a previous repo or with a typo, so the credentials were wrong.

1 Since the credential.helper key is a multi-valued config list, there's no way to "unset" a helper once it's been set. So if your system /etc/gitconfig sets one, you can never avoid running it, but only add your own helpers on top.

The following line worked for me:

git config --global credential.helper 0
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download