Welcome to the Power Users community on Codidact!
Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.
How to make git push/pull work again?
I have a bunch of GIT repositories on my laptop, which have their "origin" set to repositories on GitHub. After a commit in a local repository, I do
git push -u origin master
to update the remote repository on GitHub. This was all working fine for a long time, up until a few days ago. According to GitHub, my last successful update was 6 days ago, so 13 Aug 2022.
Now when I try to push a new version, the command just sits there for maybe 5 seconds, then ends without doing anything or writing anything to STDOUT or STDERR.
I thought this might be a permission problem, so I deleted all GitHub entries from GIT's cache, and also from the Windows credential manager. I thought that would force it to ask me for password and/or access token again, but no change.
As far as I know, I didn't change any GIT settings, and I certainly didn't update GIT since I was last able to push changes to GitHub. Local interactions with repositories still work. I can commit, view diffs, see logs, etc.
How do I make GIT interactions with remote repositories on GitHub work again?
Windows 10, using GIT from the command line.
Does pull work?
No, same symptom. The command hangs for about 5 seconds, then ends without doing anything or saying anything.
has this failed in multiple repositories?
Yes, all of them. I have dozens of local repositories that are linked to ones on GitHub as the origin. Attempts at pushing or pulling to/from all of them seem to fail the same way.
show us what git remote show origin says
Very interesting. It does the same thing, meaning it hangs for 5 seconds then does nothing. Here is a transcript:
C:\embed\source\util>git remote show origin C:\embed\source\util>
However, it seems to know something about origin:
C:\embed\source\util>git log --oneline --reverse --decorate d25440b First version in GIT. 1cf8498 (HEAD -> master, origin/master, origin/HEAD) Added error checking routines.
This looks like a strong clue for someone that knows GIT better than I do. It seems that all my local GIT repositories have "forgotten" what the origin is. I have some repositories where the origin is at BitBucket. I just checked one of those, and it has the same problem. So this is apparently an issue with GIT on my machine, not with GitHub or BitBucket.
I checked a few repositories I know I wasn't in recently, and they all have the problem. This means it must be some global GIT setting somewhere? I don't understand GIT enough to make sense of this, though.
1 answer
I fixed the problem by re-installing GIT. I also updated to the latest version instead of re-installing the existing version. I was running version 2.32.0-64 and am now running 2.37.2.2-64. However, the version update was unlikely the fix since the old version worked fine until a few days ago.
Apparently something got wiped out that was overwritten by re-installing GIT. That fixed the problem, but is a rather unsatisfactory answer since it doesn't explain what actually happened. I still don't understand how a global GIT setting could make it not even know what the origin is in all local repositories. All 91 local repositories getting clobbered the same way is highly unlikely, and wouldn't be fixed by re-installing GIT anyway. What global setting can cause GIT to not show origin, not complain about an error, and take seconds to not do anything?
3 comment threads