'Getting the error Python.framework/Versions/2.7/Python probably after MacOS Monterey 12.3.1 update

All attempt of Git push fails probably after MacOS Monterey update 12.3.1 on MacBook with Apple silicon.

% git push
dyld[56684]: Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
  Referenced from: /usr/local/Cellar/openssh/7.9p1/bin/ssh
  Reason: tried: '/System/Library/Frameworks/Python.framework/Versions/2.7/Python' (no such file), '/Library/Frameworks/Python.framework/Versions/2.7/Python' (no such file)
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

The same problem with ssh-keygen command.

Probably it is due to the fact that Apple has removed Python from macOS.

I tried to install Python 2.7 but it didn't help.



Solution 1:[1]

After a day trying to download Python 2.7 and various other things, I solved this issue by renaming Python framework directory: /System/Library/Frameworks/Python.framework/Versions/3.6 from 3.6 to 2.5. It fixed the problem.

So this might be a hot fix, but I can't recommend doing it

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mikhail Sharin