Symptom
git push reports Authentication failed, remote: Invalid username or token, or Contact support: Permission denied (publickey). Cloning public repositories works, but pushing or accessing a private repository fails.
Possible causes (most common first)
- Over HTTPS, you entered your GitHub account password. GitHub no longer accepts passwords for git authentication; you need a personal access token or another method.
- The keychain holds a credential that has expired or belongs to another account, and git tries it automatically every time.
- Over SSH, no key has been generated on this Mac yet, or the public key has not been added to your GitHub account.
- The token's scope does not cover this repository, or you only have read access to it.
Troubleshooting steps (easiest first)
First see which route you are on
Run
git remote -vin the repository folder. An address starting withhttps://uses HTTPS and one starting withgit@uses SSH, and the two are debugged in completely different ways. GitHub is the example below; the reasoning is the same for other code platforms, and their own documentation has the specifics.HTTPS: use a token and clear old credentials
When asked for a password, enter a personal access token, not your account password. If it fails with no prompt at all, the keychain holds an old credential. Following the GitHub documentation, open Keychain Access, search for github.com and delete the matching internet password entry; or run
git credential-osxkeychain erasein Terminal, typehost=github.comandprotocol=httpson separate lines, then press Return once more. Push again and enter the new token. GitHub itself recommends setting up SSH or using Git Credential Manager.SSH: check item by item
Follow the order in GitHub's troubleshooting documentation: run
ssh -T Contact support; on success it prints a greeting containing your username. The connecting user must begit, not your username. On failure, runssh-add -l -E sha256to see whether any key is loaded; no output means this machine has no usable key yet.ssh -vT Contact supportshows which key files it actually tried. Finally, open the SSH and GPG keys page in GitHub settings and check that the public key fingerprint is in the list.Create a new key on this machine; do not copy your own
We recommend generating a dedicated key on the remote Mac with
ssh-keygen -t ed25519, adding the public key to your account and naming it so that it is clearly this rented machine. Do not copy the private key from your personal computer: a dedicated key can be deleted on its own when the rental ends or you suspect a leak, without affecting other devices. The same goes for tokens. Issue a separate token for this machine with the narrowest scope you can and an expiry date.Still rejected: check account and permissions
If authentication passes but the push is rejected (a 403 or a no-permission message), the identity is fine; that identity has no write access to the repository, or the organisation requires the token to be authorised for single sign-on first. Use the greeting from
ssh -Tto confirm which account is in use. A common case is that the credential on the machine belongs to your other account.
When to contact support directly
Authentication is between you and the code platform. Support cannot see your tokens and keys, and should not. Only network-level symptoms need us: ssh -vT shows the connection timing out or being reset instead of being refused, or the browser cannot open the code platform either. Contact support on Contact support with your machine ID, when it happened and the command output with your username hidden. Do not change DNS or install proxy tools yourself for this. Before the rental ends, remember to delete this machine's public key and token on the platform.
FAQ
What does “do not run git with elevated privileges” mean?
GitHub's documentation says explicitly that git commands should not be run with administrator privilege elevation. With elevation, git reads another account's keys and configuration, cannot use the key you generated, and authentication fails as a result. It also leaves files with the wrong owner in the repository.
Related
- Remote Mac mini for heavy Claude Code use: an always-on workstation, not account insurance
- Rented Mac mini as an always-on build machine for small teams? Count your build minutes first
- Remote Mac keeps asking for the login keychain password and rejects it
- Can the rental provider see the code on my machine?
- Mac terminal shows non-English text as garbled characters, question marks or backslash numbers
Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support