ssh-agent-add-id


Namessh-agent-add-id JSON
Version 0.0.9 PyPI version JSON
download
home_pageNone
SummaryA wrapper for ssh-add that checks whether a key has already been added to the SSH agent rather than prompting for the passphrase every time.
upload_time2024-06-14 11:12:13
maintainerNone
docs_urlNone
authorAlexis Bergue
requires_python>=3.8
licenseMIT License Copyright (c) 2023 Alexis Bergue Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ssh ssh-add ssh-agent authentication key identity vscode vs code visual studio code wsl wsl2 git github gitlab bitbucket
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ssh-agent-add-id

[![PyPI version](https://img.shields.io/pypi/v/ssh-agent-add-id)](https://pypi.python.org/pypi/ssh-agent-add-id)
[![Python versions](https://img.shields.io/pypi/pyversions/ssh-agent-add-id)](https://github.com/alexisbg/ssh-agent-add-id)

A wrapper for `ssh-add` that checks whether a key has already been added to the `SSH agent` rather than prompting for the passphrase every time.

<br />

## Description
`ssh-agent-add-id` was primarily created to address a [pending issue](https://github.com/microsoft/vscode-remote-release/issues/2369) in the `VS Code` [WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl) when authenticating with an SSH key that requires a passphrase, such as for a remote Git repository. If this key has not been previously added to the `SSH agent` accessible from the [WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl), `VS Code` does not prompt for the passphrase, causing operations like pushing to the remote repository to get stuck.

`ssh-agent-add-id` serves as a wrapper for the [ssh-add](https://man.openbsd.org/ssh-add) command. However, unlike the latter, it does not prompt again for the passphrase and exits quietly if the key has already been added to the SSH agent. It can thus be easily executed in a `VS Code` task when a project is opened. 

And beyond remote Git repositories and WSL, `ssh-agent-add-id` can be also be used with cloud services that rely on SSH key authentication and thus reduce the number of times you need to enter your passphrases.

<br />

## Requirements
### SSH agent
- [ssh-add](https://man.openbsd.org/ssh-add) and [ssh-agent](https://man.openbsd.org/ssh-agent) must be installed and running.
- `SSH_AUTH_SOCK` environment variable needs be set and accessible from `VS Code` environment.
- For Linux/WSL, in order to share a single `ssh-agent` process for all your shells, it is highly recommended to either run `ssh-agent` as an [user-level systemd service](https://gist.github.com/alexisbg/12102035851c2d0555878cfd865fac75) or to install and setup [Keychain](https://github.com/funtoo/keychain).

### ssh-agent-add-id
- Requires `Python 3.8+`.
- It should run smoothly on `macOS` and all `Linux` distributions. However, on `Windows`, it only runs within [WSL](https://learn.microsoft.com/en-us/windows/wsl/).

<br />

## Installation
`ssh-agent-add-id` can be installed using `pip`:
```
pip install ssh-agent-add-id
```

### VS Code task
Add a task to your VS Code project (in [.vscode/tasks.json](https://github.com/alexisbg/ssh-agent-add-id/blob/main/templates/vs_code/tasks.json)). **Do not forget** to update the `"args"` value with the actual path of your private key file:
```json
    {
      "label": "Add Git SSH key to agent",
      "type": "shell",
      "command": "ssh-agent-add-id",
      "args": ["${userHome}/.ssh/<PRIVATE_KEY_FILE>"],
      "presentation": {
        "panel": "new",
        "revealProblems": "onProblem",
        "close": true
      },
      "runOptions": {
        "runOn": "folderOpen"
      },
      "problemMatcher": []
    }
```
Thanks to ["runOptions"/"runOn": "folderOpen"](https://code.visualstudio.com/docs/editor/tasks#_run-behavior), this task runs every time your project is opened, launching a new dedicated terminal. If the identity/key was already added to the `SSH agent`, this terminal closes immediately. Otherwise, it prompts for the key passphrase.

<br />

## Command line usage
```
usage: ssh-agent-add-id [-h] [--version] priv_key_path [pub_key_path]

positional arguments:
  priv_key_path  the path of the private key file
  pub_key_path   the path of the public key file in case its filename is not <priv_key_path>.pub

optional arguments:
  -h, --help     show this help message and exit
  --verbose      print some extra info
  --version      show program's version number and exit
```

<br />

## License
This project is licensed under the terms of the MIT license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ssh-agent-add-id",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ssh, ssh-add, ssh-agent, authentication, key, identity, vscode, vs code, visual studio code, wsl, wsl2, git, github, gitlab, bitbucket",
    "author": "Alexis Bergue",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/dd/fc/4bb0b5a93960a128ae9083fd992884897b659f208d8b5134b0c596cd708b/ssh_agent_add_id-0.0.9.tar.gz",
    "platform": null,
    "description": "# ssh-agent-add-id\n\n[![PyPI version](https://img.shields.io/pypi/v/ssh-agent-add-id)](https://pypi.python.org/pypi/ssh-agent-add-id)\n[![Python versions](https://img.shields.io/pypi/pyversions/ssh-agent-add-id)](https://github.com/alexisbg/ssh-agent-add-id)\n\nA wrapper for `ssh-add` that checks whether a key has already been added to the `SSH agent` rather than prompting for the passphrase every time.\n\n<br />\n\n## Description\n`ssh-agent-add-id` was primarily created to address a [pending issue](https://github.com/microsoft/vscode-remote-release/issues/2369) in the `VS Code` [WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl) when authenticating with an SSH key that requires a passphrase, such as for a remote Git repository. If this key has not been previously added to the `SSH agent` accessible from the [WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl), `VS Code` does not prompt for the passphrase, causing operations like pushing to the remote repository to get stuck.\n\n`ssh-agent-add-id` serves as a wrapper for the [ssh-add](https://man.openbsd.org/ssh-add) command. However, unlike the latter, it does not prompt again for the passphrase and exits quietly if the key has already been added to the SSH agent. It can thus be easily executed in a `VS Code` task when a project is opened. \n\nAnd beyond remote Git repositories and WSL, `ssh-agent-add-id` can be also be used with cloud services that rely on SSH key authentication and thus reduce the number of times you need to enter your passphrases.\n\n<br />\n\n## Requirements\n### SSH agent\n- [ssh-add](https://man.openbsd.org/ssh-add) and [ssh-agent](https://man.openbsd.org/ssh-agent) must be installed and running.\n- `SSH_AUTH_SOCK` environment variable needs be set and accessible from `VS Code` environment.\n- For Linux/WSL, in order to share a single `ssh-agent` process for all your shells, it is highly recommended to either run `ssh-agent` as an [user-level systemd service](https://gist.github.com/alexisbg/12102035851c2d0555878cfd865fac75) or to install and setup [Keychain](https://github.com/funtoo/keychain).\n\n### ssh-agent-add-id\n- Requires `Python 3.8+`.\n- It should run smoothly on `macOS` and all `Linux` distributions. However, on `Windows`, it only runs within [WSL](https://learn.microsoft.com/en-us/windows/wsl/).\n\n<br />\n\n## Installation\n`ssh-agent-add-id` can be installed using `pip`:\n```\npip install ssh-agent-add-id\n```\n\n### VS Code task\nAdd a task to your VS Code project (in [.vscode/tasks.json](https://github.com/alexisbg/ssh-agent-add-id/blob/main/templates/vs_code/tasks.json)). **Do not forget** to update the `\"args\"` value with the actual path of your private key file:\n```json\n    {\n      \"label\": \"Add Git SSH key to agent\",\n      \"type\": \"shell\",\n      \"command\": \"ssh-agent-add-id\",\n      \"args\": [\"${userHome}/.ssh/<PRIVATE_KEY_FILE>\"],\n      \"presentation\": {\n        \"panel\": \"new\",\n        \"revealProblems\": \"onProblem\",\n        \"close\": true\n      },\n      \"runOptions\": {\n        \"runOn\": \"folderOpen\"\n      },\n      \"problemMatcher\": []\n    }\n```\nThanks to [\"runOptions\"/\"runOn\": \"folderOpen\"](https://code.visualstudio.com/docs/editor/tasks#_run-behavior), this task runs every time your project is opened, launching a new dedicated terminal. If the identity/key was already added to the `SSH agent`, this terminal closes immediately. Otherwise, it prompts for the key passphrase.\n\n<br />\n\n## Command line usage\n```\nusage: ssh-agent-add-id [-h] [--version] priv_key_path [pub_key_path]\n\npositional arguments:\n  priv_key_path  the path of the private key file\n  pub_key_path   the path of the public key file in case its filename is not <priv_key_path>.pub\n\noptional arguments:\n  -h, --help     show this help message and exit\n  --verbose      print some extra info\n  --version      show program's version number and exit\n```\n\n<br />\n\n## License\nThis project is licensed under the terms of the MIT license.\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2023 Alexis Bergue\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "A wrapper for ssh-add that checks whether a key has already been added to the SSH agent rather than prompting for the passphrase every time.",
    "version": "0.0.9",
    "project_urls": {
        "Homepage": "https://github.com/alexisbg/ssh-agent-add-id",
        "Issues": "https://github.com/alexisbg/ssh-agent-add-id/issues",
        "Repository": "https://github.com/alexisbg/ssh-agent-add-id"
    },
    "split_keywords": [
        "ssh",
        " ssh-add",
        " ssh-agent",
        " authentication",
        " key",
        " identity",
        " vscode",
        " vs code",
        " visual studio code",
        " wsl",
        " wsl2",
        " git",
        " github",
        " gitlab",
        " bitbucket"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c2e6d017e33ff3fb55a0c8ab3aa9297e69d3cd2c9e34af239c36bd9bb9576298",
                "md5": "11f045f498f1eea0f16b67af03d35fdd",
                "sha256": "06fcf19134820d9c823cb8c8365e13b3d68a637904cc2e77989ea081236f6288"
            },
            "downloads": -1,
            "filename": "ssh_agent_add_id-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "11f045f498f1eea0f16b67af03d35fdd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11104,
            "upload_time": "2024-06-14T11:12:12",
            "upload_time_iso_8601": "2024-06-14T11:12:12.177175Z",
            "url": "https://files.pythonhosted.org/packages/c2/e6/d017e33ff3fb55a0c8ab3aa9297e69d3cd2c9e34af239c36bd9bb9576298/ssh_agent_add_id-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ddfc4bb0b5a93960a128ae9083fd992884897b659f208d8b5134b0c596cd708b",
                "md5": "0424a472fccf2c307ddbb2a2c48b4354",
                "sha256": "2263762e29df440378651fa7e7836b94dc0585a7cb02459882d41acb50fc4bbd"
            },
            "downloads": -1,
            "filename": "ssh_agent_add_id-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "0424a472fccf2c307ddbb2a2c48b4354",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 22543,
            "upload_time": "2024-06-14T11:12:13",
            "upload_time_iso_8601": "2024-06-14T11:12:13.417747Z",
            "url": "https://files.pythonhosted.org/packages/dd/fc/4bb0b5a93960a128ae9083fd992884897b659f208d8b5134b0c596cd708b/ssh_agent_add_id-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-14 11:12:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alexisbg",
    "github_project": "ssh-agent-add-id",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ssh-agent-add-id"
}
        
Elapsed time: 0.61994s