Change git repo to use SSH not HTTPS


I cloned a repo from GitLab this morning, made some changes, and was about to commit when I got this:

remote: HTTP Basic: Access denied
remote: You must use a personal access token with 'read_repository'
	or 'write_repository' scope for Git over HTTP.
remote: You can generate one at

Sure enough, listing the remote sources showed HTTPS not SSH:

$ git remote -v
==> origin (fetch)
==> origin (push)

So I changed:

$ git remote set-url origin


Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.