I recently upgraded to macOS Monterey and noticed that I cannot do any git commands that affect an onliene repo. Commands that are affected so far are
git push
git pull
git clone
All commands just output notinng. Literally. I type them in and there isn't even a error, even after several minutes, and the remote repo also doesn't get the push.
What I tried so far
I tried to run these commands with repos from Github and Gitlab, and with private and public repos. My ssh keys are in place, the remote URL's seem to be right, I'm not in detached HEAD mode, I reinstalled Xcode and Xcode developer tools, I upgraded git through Homebrew, I reinstalled git though Homebrew, I activated and deactivated my Firewall in my System Settings and now I tried to turn my Mac off and on again (it still didn't work).
What seems to work for now
GIT_CURL_VERBOSE=1 GIT_TRACE=1 git push
this gives me a whole log, and the push succeeds.
13:56:35.495625 git.c:455 trace: built-in: git push
13:56:35.497727 run-command.c:668 trace: run_command: unset GIT_PREFIX; ssh [email protected] 'git-receive-pack '\''airshopers/storefront.git'\'''
13:56:43.997487 run-command.c:668 trace: run_command: .git/hooks/pre-push origin [email protected]:airshopers/storefront.git
Everything up-to-date
In addition, it appears that the second git push I run after a computer restart works.
Update Adding verbose and trace flags also doesn't solve the problem, as that "workaround" randomly stops working and I see the previously mentioned behaviour again.
I'm really at the end of my knowledge, any tips are appreciated :)
CodePudding user response:
The upgrade to Monterey seems to break macOS ssh. I solved this by installing openssh from Homebrew:
brew install openssh
The installation seems to also update the default ssh used, so which ssh now points to /usr/local/bin/ssh instead of the native one.
Also make sure to open a new terminal window, or freshly source your terminal. Otherwise in your current session native ssh will be used.
This seems to have fixed the issue, I'll mark this answer as accepted if I don't encounter any new issues here.
