Help setting up machine user

I’m not clear on the instructions for how to create a machine user.

I have a Github account with several private repos. I’d like to have two of them on a single server. I log in and manage as a single Unix user, dwayne. Up until I created the second application, I’d just use a deploy key.

Since these can’t be duplicated, I see where it’s recommended to set up a machine user, for example, here:

https://github.community/t5/How-to-use-Git-and-GitHub/Newbie-How-to-use-deploy-keys/m-p/23575#

The repositories are owned by my Github account  “futura.” I do have a separate Github account that I’m not using, “dpurper,” so I’ve set this account as a collaborator. I generated a key on the server and copied it as my SSH key for that user at https://github.com/settings/keys.

So:

Github repo owner: futura
Github collaborator: dpurper
Unix user: dwayne
Github repo names:
beta
supervise

I still can’t figure out how to access the repositories from my server. I need to clone the second one, but …

sudo -u dwayne git clone dpurper@github.com:futura/beta.git

Gives me:

Cloning into 'beta'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What am I doing wrong?

Thanks.

Oh, a bit more. I named my key to match the collaborator user, so:

dpurper.id_rsa.pub

And, then, in ~/.ssh/config:

Host github.com
HostName github.com
User dpurper
IdentityFile /home/dwayne/.ssh/dpurper.id_rsa

I assume this is how I’m supposed to identify which key I want to use?

OK, solved it:

https://help.github.com/en/github/authenticating-to-github/error-permission-denied-publickey 

“All connections, including those for remote URLs, must be made as the “git” user. If you try to connect with your GitHub username, it will fail”

So, this works:

sudo -u dwayne git clone git@github.com:futura/beta.git