Multiple GitHub Users in OS X (Part 1)

Short version: use https links.

By Matthew Malinowski, 2013-10-24

And another of several "new Mac OS X install" posts to remind me of my settings the next time I do this.

If you have more than one GitHub user, it can be very annoying to try to manage them all on one computer.

There are about 16 things to say about this, so I'll focus on the easiest one in this quick post.

Add your username to your https repo links. Easy as that.

An example. For this site, instead of: git clone, I'd use git clone Because that's a public repo, it won't ask me for my password on clone or pull, but it will ask me for my password on push. I just give it my Personal Access Token (or password, if I wasn't using 2 factor auth), credential-osxkeychain saves it, and away we go.

To see if an existing repo is using this URL scheme, try git remote -v, which for this site returns:

origin (fetch)
origin (push)

For existing repos, you can just remove the remotes and re-add them using the new scheme.

Other problem areas with multiple GitHub users include easily and automatically managing different commit author name and email (no solution for this one yet) and ssh repo addresses (I have a solution but just use https if you can).

Back to Blog Index...