I had set up my SSH key long ago in my GitHub account. Yet when I git pushed to GitHub, it still asked me for my username and password.

After I double checked my key at https://github.com/settings/keys, I thought it might be that my git settings had been reset? It turns out, the origin URL was wrong. For some reason it was in the form https://github.com/username/reponame.git. To use the SSH key, it should have been git@github.com:username/reponame.git.

% git push origin HEAD
Username for 'https://github.com':
...
% git remote get-url origin
https://github.com/username/reponame.git
% git remote set-url origin git@github.com:username/reponame.git
% git push origin HEAD
Everything up-to-date