{"id":13586924,"url":"https://github.com/chrishunt/github-auth","last_synced_at":"2025-04-12T19:45:40.604Z","repository":{"id":8024695,"uuid":"9433873","full_name":"chrishunt/github-auth","owner":"chrishunt","description":"SSH key management for GitHub users","archived":false,"fork":false,"pushed_at":"2018-08-27T22:07:18.000Z","size":357,"stargazers_count":384,"open_issues_count":3,"forks_count":19,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-04-25T10:21:55.922Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrishunt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-14T19:13:04.000Z","updated_at":"2024-03-12T12:37:31.000Z","dependencies_parsed_at":"2022-09-13T10:40:37.456Z","dependency_job_id":null,"html_url":"https://github.com/chrishunt/github-auth","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrishunt%2Fgithub-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrishunt%2Fgithub-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrishunt%2Fgithub-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrishunt%2Fgithub-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrishunt","download_url":"https://codeload.github.com/chrishunt/github-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625491,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:05:54.371Z","updated_at":"2025-04-12T19:45:40.566Z","avatar_url":"https://github.com/chrishunt.png","language":"Ruby","readme":"# github-auth\n\n[![](http://img.shields.io/travis/chrishunt/github-auth.svg?style=flat)](https://travis-ci.org/chrishunt/github-auth)\n[![](http://img.shields.io/codeclimate/github/chrishunt/github-auth.svg?style=flat)](https://codeclimate.com/github/chrishunt/github-auth)\n[![](http://img.shields.io/gem/v/github-auth.svg?style=flat)](http://rubygems.org/gems/github-auth)\n\n### Pairing with strangers has never been so good.\n\n**github-auth** allows you to quickly pair with anyone who has a GitHub account\nby adding and removing their public ssh keys from your\n[`authorized_keys`](http://en.wikipedia.org/wiki/Ssh-agent) file.\n\n## Description\n\nIf you agree to [\\#pairwithme](https://twitter.com/search?q=pairwithme), we'll\nprobably be SSHing into my laptop, your laptop, or some laptop in the sky.\nSharing passwords over email is no fun, so we'll use public key authentication\nto keep things fun, fast, and secure.\n\nLet's see how this works.\n\nAfter you've [installed](#installation) `gh-auth`, you can give me ssh access\nwith:\n\n```bash\n$ gh-auth add --users=chrishunt\nAdding 2 key(s) to '/Users/chris/.ssh/authorized_keys'\n```\n\nIf you'd like me to automatically connect to your existing tmux session, you\ncan do that with a custom ssh command:\n\n```bash\n$ gh-auth add --users=chrishunt --command=\"tmux attach\"\nAdding 2 key(s) to '/Users/chris/.ssh/authorized_keys'\n```\n\nThat was easy! When we're done working, you can revoke my access with:\n\n```bash\n$ gh-auth remove --users=chrishunt\nRemoving 2 key(s) from '/Users/chris/.ssh/authorized_keys'\n```\n\nYou can add and remove any number of users at the same time.\n\n```bash\n$ gh-auth add --users=chrishunt zachmargolis\nAdding 4 key(s) to '/Users/chris/.ssh/authorized_keys'\n\n$ gh-auth list\nchrishunt zachmargolis\n\n$ gh-auth remove --users=chrishunt\nRemoving 2 key(s) from '/Users/chris/.ssh/authorized_keys'\n\n$ gh-auth list\nzachmargolis\n\n$ gh-auth remove --users=zachmargolis\nRemoving 2 key(s) from '/Users/chris/.ssh/authorized_keys'\n\n$ gh-auth list\n\n```\n\nIf you'd like to remove all GitHub users in one fatal swoop, you can do that\ntoo.\n\n```bash\n$ gh-auth remove --users=`gh-auth list`\n```\n\n## Sections\n\n  1. [Usage](#usage)\n     - [Command Line](#command-line)\n     - [In Your Project](#in-your-project)\n  1. [Installation](#installation)\n     - [SSH Public Key Authentication](#ssh-public-key-authentication-mac-os-x)\n     - [Verification](#verification)\n  1. [Troubleshooting](#troubleshooting)\n     - [How do people actually connect to my machine?](#how-do-people-actually-connect-to-my-machine)\n     - [What username do I use?](#what-username-do-i-use)\n     - [How do I get my external IP?](#how-do-i-get-my-external-ip)\n     - [It's still not working!](#its-still-not-working-)\n     - [I can't enable port forwarding](#i-cant-enable-port-forwarding-my-boss-wont-let-me-can-i-still-pair)\n  1. [Contributing](#contributing)\n  1. [Changelog](#changelog)\n  1. [License](#license)\n\n## Usage\n\n### Command Line\n\n`gh-auth` can be used from the command line after the gem has been installed.\n\n```\n$ gh-auth\nCommands:\n  gh-auth add --users=one two three     # Add GitHub users to authorized keys\n  gh-auth help [COMMAND]                # Describe available commands or one specific command\n  gh-auth list                          # List all GitHub users already added to authorized keys\n  gh-auth remove --users=one two three  # Remove GitHub users from authorized keys\n  gh-auth version                       # Show gh-auth version\n\nOptions:\n  [--host=HOST]\n  [--path=PATH]\n```\n\nUse the `help` command for help on a specific command.\n\n```\n$ gh-auth help add\nUsage:\n  gh-auth add --users=one two three\n\nOptions:\n  --users=one two three\n  [--command=COMMAND]\n  [--host=HOST]\n  [--path=PATH]\n\nDescription:\n  `gh-auth add` is used to add one or more GitHub user's public SSH keys to ~/.ssh/authorized_keys. All keys stored on github.com for that user will be added.\n\n  \u003e $ gh-auth add --users=chrishunt zachmargolis\n  \u003e Adding 6 key(s) to '/Users/chris/.ssh/authorized_keys'\n\n  By default, users will be granted normal shell access. If you'd like to specify an ssh command that should execute when the user connects, use the `--command` option.\n\n  \u003e $ gh-auth add --users=chrishunt --command=\"tmux attach\"\n```\n\n### In Your Project\n\nWant to add/remove keys in your project, but not on the command line? That's ok\ntoo.\n\n```ruby\nrequire 'github/auth'\n\n# Add keys for GitHub user 'chrishunt'\nGitHub::Auth::CLI.start %w(add --users=chrishunt)\n\n# Remove keys for GitHub user 'chrishunt'\nGitHub::Auth::CLI.start %w(remove --users=chrishunt)\n```\n\n## Installation\n\nInstall the `github-auth` gem:\n\n```bash\n$ gem install github-auth\n```\n\n### SSH Public Key Authentication (Mac OS X)\n\nPublic key authentication works with Mac OS by default, but you'll need to get\nyour ssh server running. This is done by ticking 'Remote Login' in the\n'Sharing' panel of System Preferences.\n\n![](https://raw.github.com/chrishunt/github-auth/master/img/mac-os-ssh-sharing.jpg)\n\nNow that SSH is running, make sure you have the correct permissions set for\nyour authorized keys.\n\n```bash\n$ chmod 700 ~/.ssh\n$ chmod 600 ~/.ssh/authorized_keys\n```\n\n### Verification\n\nIf you'd like to verify that everything is working as expected, you can test\nlocally on your own machine.\n\nFirst, authorize yourself for ssh. (Make sure to replace 'chrishunt' with\n*your* GitHub username)\n\n```bash\n$ gh-auth add --users=chrishunt\nAdding 2 key(s) to '/Users/chris/.ssh/authorized_keys'\n```\n\nNow that your keys are added, verify that you can open an SSH session to your\nmachine with public key authentication:\n\n```bash\n$ ssh -o PreferredAuthentications=publickey localhost\n\n(localhost)$\n```\n\nNext, remove your public keys from the keys file:\n\n```bash\n$ gh-auth remove --users=chrishunt\nRemoving 2 key(s) from '/Users/chris/.ssh/authorized_keys'\n```\n\nNow that you've removed your keys, verify that you can no longer log in to your\nmachine with public key authentication:\n\n```bash\n$ ssh -o PreferredAuthentications=publickey localhost\n\n\u003e Permission denied (publickey,keyboard-interactive)\n```\n\n## Troubleshooting\n\n### How do people actually connect to my machine?\n\nGood question! Others will connect to your machine using ssh:\n\n```bash\n$ ssh username@external-ip-address\n```\n\n### What username do I use?\n\nThe `username` is going to be the same username that you used to add the keys.\nIn most cases, it's a good idea to create a new `pair` account and use that\naccount for all pairings. You don't want strangers reading your email!\n\nOnce you've created the pair account, you can switch to it yourself in a\nterminal with:\n\n```bash\n$ su - pair\n```\n\n### How do I get my external IP?\n\nYou can get your external IP address with:\n\n```bash\n$ curl http://checkip.amazonaws.com/\n```\n\n### It's still not working! :(\n\nIn almost all cases, your laptop is not directly plugged into your modem.\nYou're on a wireless network or plugged directly into a router or switch. This\nmeans the external IP address that your pair is connecting to is not your\nmachine, it's actually your router.\n\nYou can tell your router to forward ssh connections to your machine by enabling\n[port forwarding](http://en.wikipedia.org/wiki/Port_forwarding). You will want\nto forward port `22` (ssh) to the local IP address of your machine.\n\nIf port `22` is already forwarded to another machine or you want to change\nthings up, you can have ssh listen on another port and have your pair connect\nwith:\n\n```bash\nssh -p \u003cport\u003e username@external-ip-address\n```\n\n### I can't enable port forwarding, my boss won't let me. Can I still pair?\n\nYes! A nice solution to this is to have a machine **somewhere else** that both\nof you can ssh into. Place this machine on a network that you *do* have the\nability to forward ports. Maybe this machine is at home, a friend's house, or\nat a company you worked for in the past that forgot to turn it off.\n\nIf this isn't possible, then you can use a VPS provider like\n[Linode](http://www.linode.com) to setup a pairing machine in the cloud or a\ntunneling solution like [PageKite](https://pagekite.net) or\n[Hamachi](https://secure.logmein.com/products/hamachi) to make your machine\naccessible without forwarding ports.\n\n## Contributing\nPlease see the [Contributing\nDocument](https://github.com/chrishunt/github-auth/blob/master/CONTRIBUTING.md)\n\n## Changelog\nPlease see the [Changelog\nDocument](https://github.com/chrishunt/github-auth/blob/master/CHANGELOG.md)\n\n## License\nCopyright (C) 2013 Chris Hunt, [MIT\nLicense](https://github.com/chrishunt/github-auth/blob/master/LICENSE.txt)\n","funding_links":[],"categories":["Ruby","Apps"],"sub_categories":["*SSH* keys / Authentication"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrishunt%2Fgithub-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrishunt%2Fgithub-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrishunt%2Fgithub-auth/lists"}