This is a script for setting up my laptop. It works in conjunction with my dotfiles repo
- Make sure that the home directory is
ryanhedgesso that scripts and things that are currently not dynamic properly look for the files.
This is intended to be used on a brand new machine so you'll have to curl the project and unzip it.
$ curl -o ~/settop-master.zip -Lk https://github.com/ryanhedges/settop/archive/master.zip
$ unzip ~/settop-master.zip -d ~/
$ mv ~/settop-master ~/init-settop
$ rm ~/settop-master.zipOpen app store and ensure that the apple account that downloads Mac apps is signed in. This can be triggered by going to Account Settings. I have to switch my personal Apple ID to my application Apple ID for this to work.
If you encounter an error like:
Error: No downloads initiated for ADAM ID 497799835
it indicates the App Store account is not properly authenticated or the app is not available for download with the current Apple ID. Verify you are signed in with the correct application Apple ID.
-
Run the settop script
$ sh ~/init-settop/settop.shFirst run will prompt for:
- SSH key passphrase (save to your password manager)
- A nickname for the machine's SSH keys (defaults to macOS computer name, used for GitHub UI identification)
ghCLI authentication via browser (opens browser to authenticate, requestsadmin:public_keyandadmin:ssh_signing_keyscopes)- Additional browser prompts if
ghtoken needs scope refresh (only on re-runs with existing auth)
SSH keys are uploaded to GitHub as both authentication and signing keys. Verified commits are configured automatically using SSH signing (configured in
~/.dotfiles/git/gitconfig). -
Run the script to copy this repo for future development
$ sh ~/init-settop/clone_and_link.sh -
Remove the initial download
$ rm -rf ~/init-settop
For each Bitbucket account, run the add-account script:
$ sh ~/projects/ryanhedges/settop/scripts/bitbucket/add-account.shThe script will prompt for:
- Alias: short name for the account (e.g.,
prismlabs,acme) - Email: the email associated with the Bitbucket account
- Project directory: where repos for this account live (default:
~/projects/<alias>/)
Prerequisites:
- Run
settop.shfirst (sets up dotfiles and GitHub SSH key) - Create the project directory before running (e.g.,
mkdir -p ~/projects/prismlabs/)
The script will:
- Generate a unique SSH key for the account
- Configure git to use that key when inside the project directory
- Print the public key and URL for manual upload to Bitbucket
- Verify the key works after upload
Verification:
$ ssh -i ~/.ssh/bitbucket_<alias> -o IdentitiesOnly=yes -o ConnectTimeout=10 -F /dev/null -T git@bitbucket.org
** WARNING: connection is not using a post-quantum key exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html
authenticated via ssh key.
You can use git to connect to Bitbucket. Shell access is disabledNote:
ssh -T git@bitbucket.orgwithout explicit key flags is unreliable when multiple Bitbucket accounts are configured. SSH config can only match on hostname, so it always uses whicheverHost bitbucket.orgentry appears first inconfig.d/. The command above bypasses SSH config entirely and tests the specific key directly.
How it works:
- SSH keys are stored in
~/.ssh/bitbucket_<alias> - Per-account git config is in
~/.dotfiles/git/gitconfig-<alias> - The main
~/.dotfiles/git/gitconfigusesincludeIfto route git operations based on directory - When inside
~/projects/<alias>/, git automatically uses the correct SSH key and email
Read the manual setup guide to run through the checklist