October 1, 2026

The mac mini -- git and github

The Mac shipped with a perfectly good git command. I have been using it to clone several things I want to experiment with.

Now I am making changes and want to be able to push back to github.

The first time I do a commit, I get a message from git that it has automatically set my name and host. It recommends that I use this command to ensure that things are correct:

git config --global --edit

Adding new user and host to github

I go to Github and login. It uses 2 factor authentication and sends me a text message.

Now to find the ssh setup, I click my tiny profile picture in the upper right and select "settings". In the column on the left, I see SSH and GPG keys, so I select it. A green button says "new SSH key". This gives me a form. I name the key "Mac", call it an authentication key, and then paste the file cat id_rsa.pub into the form. I change the end to be tom@chispa

Github now shows me as having two keys (the first one from 9-10-2016). As recommended, I run this command to verify things are correct:

ssh -T git@github.com
It works fine. I get the message:
Hi trebisky! You've successfully authenticated, but GitHub does not provide shell access.
However, when I try to push, it asks for a user/password. I did the clone like this:
git clone https://github.com/trebisky/H743.git
Looking at an old working project, I see this in .git/config
url = git@github.com:trebisky/Kyu.git
So I make these changes (changing the first line into the second).
url = https://github.com/trebisky/H743.git
url = git@github.com:trebisky/H743.git
Now it works and I can push changes. To avoid all of this, clone using ssh. Github usually offers this choice, but sometimes it only offers https or "Github CLI". It seems that you need to login to Github to have it offer SSH, but you can always hand craft the URL as I have shown.
Have any comments? Questions? Drop me a line!