IDK
IDK

Reputation: 445

Git not responding

Why can't I push to remote?

> git status
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
 (use "git push" to publish your local commits)

nothing to commit, working tree clean


> git push

> git push --verbose

I didn't forget the output, It just isn't there. This never happened to me.

In my little experience, 95% of the times the problem with git has to do with credentials. So I tried forcing git to ask me for them:

> git push -v --verbose

nothing.

I was pushing happily this morning, didn't touch anything in between...

EDIT (answering questions/adding info):

> git remote -v

origin  https://[email protected]/myusername/someproject.git (fetch)
origin  https://[email protected]/myusername/someproject.git (push)
> git --version

git version 2.37.3.windows.1

> Get-ComputerInfo | select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer

WindowsProductName WindowsVersion OsHardwareAbstractionLayer
------------------ -------------- --------------------------
Windows 10 Home    2009           10.0.19041.1806 

I have neither of those env var:

> gci env:* | sort-object name | grep GIT_DIR
> gci env:* | sort-object name | grep GIT_WORK_TREE

I only have C:\Program Files\Git\cmd in the Path env var.

And the behaviour I get when trying with Sourcetree is the same.

This also shows nothing:

> git config --global credential.helper

although I do have saved bitbucket credentials in my windows credential manager and I've always used those for authentication.

I'm now having the same problem with other repositories hosted on github.

At least now I'm getting a popup error:

enter image description here

EDIT (Solved):

I solved by uninstalling and reinstalling git.

Upvotes: 4

Views: 772

Answers (2)

VonC
VonC

Reputation: 1323175

You would need to check what version of Git you are using, with which OS and what environment variables are set (a GIT_DIR or GIT_WORK_TREE for instance could influence a command like git pull)

But try also the same operation from a different tool (like a Visual Studio Code for instance, or an Eclipse, the later one using its own Java-based Git, called JGit). That way, you would know if the behavior is consistent or not.


If HTTPS is not working, try and switch to an SSH URL:

git remote set-url origin [email protected]:myusername/someproject.git

(make sure to set up an SSH key in your Bitbucket account first)


Check also what credential manager is caching your HTTPS credentials:

git config --global credential.helper

Depending on your OS and helper value, said helper might have a problem responding with the cached credentials.

On Windows, assuming a helper set to manager-core, check your credentials with, in a CMD (no bash needed):

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set "GH=%ProgramFiles%\Git"
set "PATH=%GH%\bin;%GH%\cmd;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%"

printf "host=bitbucket.org\nprotocol=https\nusername=myusername-admin"| git-credential-manager-core get

The OP confirms an issue with the credential.helper (empty)

OP's solution: uninstalling and reinstalling git.

Upvotes: 3

Fernando
Fernando

Reputation: 11

Try Checking if you have remote a repository

git remote -v

if you have then

git push <yourbranchname>

Or... Change something a commit again

  • Try to change a file
  • git add <file>
  • git commit -m 'commit'
  • git push

Upvotes: 1

Related Questions