GitPython and SSH Keys?

Following worked for me on gitpython==2.1.1 import os from git import Repo from git import Git git_ssh_identity_file = os.path.expanduser(‘~/.ssh/id_rsa’) git_ssh_cmd = ‘ssh -i %s’ % git_ssh_identity_file with Git().custom_environment(GIT_SSH_COMMAND=git_ssh_cmd): Repo.clone_from(‘git@….’, ‘/path’, branch=”my-branch”)

The authenticity of host ‘github.com (192.30.252.128)’ can’t be established

Danger ahead, unless you actually don’t care about secure communication with github on your local account Ssh rightly complains that they can’t make sure you are indeed connecting to github’s server through a secure channel. That might be why github is recommending https access, which works out-of-the-box thanks to its public key infrastructure. Now, you … Read more

Push to GitHub without a password using ssh-key

If it is asking you for a username and password, your origin remote is pointing at the HTTPS URL rather than the SSH URL. Change it to ssh. For example, a GitHub project like Git will have an HTTPS URL: https://github.com/<Username>/<Project>.git And the SSH one: [email protected]:<Username>/<Project>.git You can do: git remote set-url origin [email protected]:<Username>/<Project>.git to … Read more

Why are connections to GitHub over SSH throwing an error “Warning: Remote Host Identification Has Changed”?

This happened because on the 24th of March 2023, GitHub updated their RSA SSH host key used to secure Git operations for GitHub.com because the private key was briefly exposed in a public GitHub repository. You will get that message if you had remembered GitHub’s previous key fingerprint in your SSH client before that date. … Read more