Mac hosting guide

Git and Xcode Source Control on a Remote Mac

Forward your laptop's SSH agent so your GitHub key never lands on the Mac, set git identity per macOS account, and sign commits with GPG using pinentry-mac. A setup script covers a fresh account.

Figment editorial teamPublished Updated Facts checked November 10, 2026

Figment Mac plans

US East. Pay before use. Hourly and daily too.

Intel Mac VM4 shared vCPUs, 4GB RAM, 80GB SSD$25per monthApple Silicon Mac VM4 shared vCPUs, 4GB RAM, 65GB SSD$39per monthDedicated M4 Pro12-core CPU, 24GB RAM, 512GB SSD$199per month

Minimum first purchase: $25 of account credit, used for your rental.

To use git on a shared rented Mac, forward your laptop's SSH agent so your GitHub key never touches the Mac, set user.name and user.email in each macOS account, and sign commits with GPG using pinentry-mac. That keeps every commit attributed, every push authenticated, and signing keys off the machine in plaintext. Both mechanisms are standard macOS features: agent forwarding keeps your private key on your laptop, and each macOS user has their own Keychain and gpg-agent.

How do I authenticate to GitHub without storing a key on the Mac?

Use SSH agent forwarding. When the remote Mac needs to authenticate with GitHub, the SSH daemon passes the challenge back to your local ssh-agent, which signs it and returns the response. The private key never leaves your laptop.

Configure it once in your local ~/.ssh/config:

Host figment-mac
  HostName mac.yourfigment.host     # your Mac's hostname
  User alice
  IdentityFile ~/.ssh/id_ed25519
  ForwardAgent yes

Verify that your local agent has the key loaded before connecting:

ssh-add -L   # should list your public key; if empty, run: ssh-add ~/.ssh/id_ed25519

Then test after SSH-ing in:

ssh -T git@github.com
# Hi alice! You've successfully authenticated…

If the test fails, check that the remote Mac's /etc/ssh/sshd_config contains AllowAgentForwarding yes and that SSH_AUTH_SOCK is set in your remote session (echo $SSH_AUTH_SOCK should print a socket path). GitHub's Using SSH agent forwarding guide documents the full setup, troubleshooting and the trust caveat: forward only to hosts you trust, because a user with root on the remote can use the forwarded socket to authenticate as you for the duration of your session.

For GitHub, your remote URL must use the SSH form (git@github.com:org/repo.git). An HTTPS remote ignores the forwarded agent.

How do I set git identity per macOS account?

On a shared Mac, each macOS account configures its own user.name and user.email after first login:

git config --global user.name  "Alice Developer"
git config --global user.email "alice@yourteam.com"

--global writes to ~/.gitconfig, which is scoped to the current macOS account, not the whole machine. If one repository needs a different identity, for example a contract project under another email, run git config --local from inside that repo. It writes to .git/config and overrides the global value there only.

Confirm the active identity at any time:

git config --list --show-origin | grep user

--show-origin prints the file path next to each value, so it is obvious whether a setting comes from global or local config.

How do I sign commits with GPG on the remote Mac?

Set it up as on a local Mac, with one extra step: install pinentry-mac, so gpg-agent can show the passphrase prompt in the remote desktop session instead of trying to open a native dialog that blocks indefinitely.

# Install GPG and pinentry-mac (run once per macOS account)
brew install gnupg pinentry-mac

# Generate a signing key (ed25519 or RSA 4096)
gpg --full-generate-key

# Note the key ID (long form after the slash on the 'sec' line)
gpg --list-secret-keys --keyid-format LONG
# Example output:
# sec   ed25519/3AA5C34371567BD2 2026-11-10 [SC]

KEY_ID=3AA5C34371567BD2    # replace with your own

git config --global user.signingkey "$KEY_ID"
git config --global commit.gpgsign true
git config --global gpg.program "$(which gpg)"

mkdir -p ~/.gnupg
chmod 700 ~/.gnupg
echo "pinentry-program $(brew --prefix)/bin/pinentry-mac" > ~/.gnupg/gpg-agent.conf
gpgconf --kill gpg-agent   # restart agent to pick up the new config

Export the public key and upload it to GitHub under Settings → SSH and GPG keys → New GPG key:

gpg --armor --export "$KEY_ID" > ~/gpg-public-key.asc
cat ~/gpg-public-key.asc   # copy into GitHub's key field

pbcopy relies on a local display session and is not reliable over SSH, so writing to a file and reading it is the portable route.

Private key handling: never write a private key to a plaintext file on the remote Mac. If you must move an existing key, export it on your laptop as a passphrase-protected armored secret (gpg --export-secret-keys --armor "$KEY_ID" | gpg --symmetric --cipher-algo AES256 -o key.asc.gpg), transfer the encrypted file, import it on the remote, and delete the transferred file immediately. Signing certificates (code-signing .p12) are a separate artifact with their own encrypted export, and provisioning profiles are plain .mobileprovision files from the developer portal, not Keychain exports.

Is there a script that sets all of this up for a fresh account?

Yes. Save this as git-setup.sh, copy it to the remote Mac, and run it once per new macOS account. set -euo pipefail stops on the first real error so you see where a step fails. The GitHub auth check is allowed to warn without aborting.

#!/usr/bin/env bash
# git-setup.sh – run as the target developer's macOS account on the remote Mac
set -euo pipefail

: "${GIT_NAME:?Set GIT_NAME, e.g. export GIT_NAME='Alice Developer'}"
: "${GIT_EMAIL:?Set GIT_EMAIL, e.g. export GIT_EMAIL='alice@yourteam.com'}"

echo "==> Configuring git identity"
git config --global user.name  "$GIT_NAME"
git config --global user.email "$GIT_EMAIL"
git config --global init.defaultBranch main

echo "==> Checking forwarded SSH agent"
if ! ssh-add -L >/dev/null 2>&1; then
  echo "WARNING: no keys in forwarded agent. Run 'ssh-add ~/.ssh/id_ed25519' locally and reconnect." >&2
fi

echo "==> Testing GitHub SSH auth (non-fatal)"
if ssh -o BatchMode=yes -T git@github.com 2>&1 | grep -q "successfully authenticated"; then
  echo "GitHub SSH auth: OK"
else
  echo "WARNING: GitHub SSH auth did not succeed. Check ForwardAgent in local ~/.ssh/config." >&2
fi

echo "==> Installing GPG tools (requires Homebrew)"
command -v brew >/dev/null || { echo "Homebrew required: https://brew.sh" >&2; exit 1; }
brew install --quiet gnupg pinentry-mac

echo "==> Configuring gpg-agent to use pinentry-mac"
mkdir -p ~/.gnupg && chmod 700 ~/.gnupg
echo "pinentry-program $(brew --prefix)/bin/pinentry-mac" > ~/.gnupg/gpg-agent.conf
gpgconf --kill gpg-agent

cat <<'NEXT'

Done. Next steps for commit signing:
  1. gpg --full-generate-key
  2. gpg --list-secret-keys --keyid-format LONG
  3. git config --global user.signingkey <KEY_ID>
  4. git config --global commit.gpgsign true
  5. gpg --armor --export <KEY_ID>   # upload to GitHub
NEXT

This is an untested example to adapt to your project, not a reported benchmark.

Should I use Xcode's Source Control Navigator or the CLI?

Use the Navigator when you are already in Xcode and the visual diff helps, and the CLI for everything automated. Xcode's built-in Source Control Navigator (⌘-2) is good for reviewing branch history, staging individual lines and switching branches. It reads the same per-account git configuration as the CLI, so identity and signing settings apply automatically. Apple's Xcode documentation covers the current feature set, and the capabilities depend on your installed Xcode version.

For merge resolution over a remote desktop, Xcode's two-pane diff viewer highlights conflict markers and lets you take left, right or hand-edit. For automation (pre-commit hooks, CI steps, batch rebases), stay in the terminal, where CLI git is faster and composable.

How do I keep credentials secure?

CredentialCorrect locationWhat to avoid
GitHub SSH private keyLocal laptop only, forwarded via agentCopying the private key to the remote Mac
GPG signing private keymacOS Keychain (gpg-agent) on remote MacWriting a plaintext export
App Store Connect API key (.p8)CI secret store, injected per jobCommitting to the repository
Git remote password (HTTPS)git config --global credential.helper osxkeychain~/.netrc or ~/.git-credentials

If your team uses a secret manager (1Password, Vault, AWS Secrets Manager), share only the required secret names, and let each developer retrieve the values through the manager on the remote Mac. Do not dump the whole environment to a file. It mixes API tokens with harmless variables and is a common source of accidental leaks. Update the firewall or artifact-store allowlists you control if you tunnel through specific egress IPs. There is no App Store Connect or TestFlight allowlist to add here.

Which Figment Mac plan fits a shared git workflow?

Several developer accounts on one Mac need administrator access and multiple macOS users, so the Dedicated M4 Pro 48 GB ($349 a month, or $299 a month on a 12-month term) is the natural fit. For one or two developers, the Apple Silicon Mac VM ($39 a month, $6 a day) works. The Intel Mac VM ($25 a month) runs macOS Sequoia and fits Xcode 26.3 or earlier. Every plan includes SSH, so agent forwarding works on all three. Figment does not back up your Mac, so keep your history on GitHub.

For price context, here are other published entry points:

  • CloudMac Mac mini M4 (16GB / 256GB): $99.99/month, with a $999/year offer on the CloudMac homepage ($83.25 effective monthly). Twelve months of the Dedicated M4 Pro 48 GB is $3,228 paid up front, and twelve months of the Apple Silicon Mac VM is 12 × $39 = $468. The VM has shared vCPUs and 4GB RAM, so it is not the same hardware class as a 16GB M4 Mac mini.
  • MacStadium M2.S $109/month, M4.S (16GB/256GB) $149/month, M4.M $249/month, with a published 99.99% uptime claim and included support.

Software licenses, Apple Developer Program membership and signing certificates stay with you, and we do not run CI for you. Check the macOS version shown before purchase against Apple's Xcode table. See all Mac hosting plans.


Related: Debug Core Data Issues on a Rented Remote Mac · SwiftData Migration on a Remote Mac · GitHub Actions Self-Hosted Runner on Mac

Which Figment Mac fits this work?

Intel Mac VM from $25 a month, Apple Silicon Mac VM from $39, or a Dedicated M4 Pro for $199. Hourly and daily plans too. You pay before use, starting with at least $25 of account credit.

Choose a Mac plan