Metadata-Version: 2.4
Name: gitconfig-cli
Version: 1.0.1
Summary: Cross-platform Git + SSH configuration CLI
Author: Abdullah Shaikh
License-Expression: MIT
Project-URL: Homepage, https://github.com/Abdullah-Shaikh03/GitConfig
Project-URL: Repository, https://github.com/Abdullah-Shaikh03/GitConfig
Project-URL: Issues, https://github.com/Abdullah-Shaikh03/GitConfig/issues
Keywords: git,ssh,cli,multiple accounts
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Version Control :: Git
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# gitconfig-cli

`gitconfig-cli` manages SSH keys and Git identities for people who use multiple accounts on GitHub, GitLab, Bitbucket, or a custom Git server.

## Features

- Separate SSH keys and host aliases for multiple accounts
- A managed SSH include file, leaving unrelated SSH configuration in place
- Per-repository Git name, email, and SSH key selection
- SSH connection checks and environment diagnostics
- JSON metadata export for backup

## Install

```bash
python -m pip install gitconfig-cli
```

Requires Python 3.10 or newer, Git, and OpenSSH. Linux and macOS are the primary supported platforms. Windows may work in environments with compatible Git and OpenSSH installations; Windows CI coverage is not yet configured.

## Add an account

```bash
gitconfig add --provider github --account work --name "Your Name" --email work@example.com
```

The command generates an encrypted key by prompting for a passphrase, writes an SSH host alias, and prints the public key and the provider's key settings page. Add the public key to your provider before testing the connection. The key is stored under `~/.ssh/` and the config metadata is stored under the platform's user config directory.

For a custom server, supply its hostname:

```bash
gitconfig add --provider custom --host git.example.com --account work --email work@example.com
```

For automation, use both `--non-interactive` and the explicit `--no-passphrase` option. This creates an unencrypted private key, so use it only where that tradeoff is appropriate.

## Use an account

Clone through the generated alias:

```bash
git clone git@github-work:org/repo.git
```

Or select an account inside an existing repository:

```bash
cd repo
gitconfig use work
```

This sets the repository's `user.name`, `user.email`, and `core.sshCommand`. Global Git identity is left alone.

## Other commands

```bash
gitconfig list
gitconfig test work --verbose
gitconfig doctor
gitconfig remove work
gitconfig remove work --yes
gitconfig export > backup.json
gitconfig export --output backup.json
```

`remove` asks before deleting the private key. `--yes` skips that prompt. `export` backs up account metadata only; it does not include private or public key files.

## Configuration files

The tool stores its SSH aliases in `~/.ssh/gitconfig-cli.conf` and adds an `Include ~/.ssh/gitconfig-cli.conf` line at the top of `~/.ssh/config`. It stores account metadata in `config.json` under the platform's user configuration directory. `XDG_CONFIG_HOME`, `%APPDATA%`, and `GITCONFIG_CONFIG_DIR` are honored where applicable. Set `GITCONFIG_SSH_DIR` to use a different SSH directory.

## License

MIT. See [LICENSE](LICENSE).
