Skip to main content

Add your description here

Project description

git-assume: A CLI Tool to Switch Your .netrc Configuration

PyPI - Version Python Version from PEP 621 TOML GitHub Actions Workflow Status Codecov

git-assume helps you manage multiple .netrc configurations with ease.

Features

  • List available .netrc profiles.
  • Switch between different .netrc profiles.

Installation

pip install git-assume

Prerequisites

Create .netrc-longterm File

Create a .netrc-longterm file in your home directory. This file should be in INI file format, with each section representing a different .netrc profile.

Example .netrc-longterm:

[default]
machine = github.com
login = someone-foo
password = ghp_xxxxxxxxxx

[sub]
machine = github.com
login = someone-hoge
password = ghp_yyyyyyyyyy

CAUTION: Your Git password is stored in plain text. Ensure that the permissions of your .netrc-longterm file are restricted to you.

Backup Your .netrc File (Optional)

Since this tool overwrites your .netrc file, it's advisable to back it up before running the CLI.

cp ~/.netrc ~/.netrc-backup

Basic Usage

git-assume provides two subcommands: list and assume.

list: List Available Profiles

Use the list subcommand to display current profiles:

$ git-assume list
Profiles that exist in .netrc-longterm: /home/someone/.netrc-longterm
- default
- sub
Argument Required Default Detail
--netrc-longterm No ~/.netrc-longterm Filepath to your .netrc-longterm.
--log-level No INFO Log level. Choices: ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "NOTSET"]

assume: Switch Your .netrc Profile

Use the assume subcommand to switch profiles:

$ git-assume assume default
Are you sure you want to overwrite /home/someone/.netrc with profile `default`? [Y/n] Y
INFO - Successfully wrote to .netrc: /home/someone/.netrc
Argument Required Default Detail
--netrc-longterm No ~/.netrc-longterm Filepath to your .netrc-longterm.
--netrc No ~/.netrc Filepath to your .netrc.
--log-level No INFO Log level. Choices: ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "NOTSET"]
-y, --yes No False If True, it overwrites .netrc file without any confirmation.

How It Works

When you run the assume subcommand, git-assume overwrites your .netrc file with the profile specified.

Example Workflow

$ git pull origin main
Username for 'https://github.com/xxx/yyy.git':
^C

$ git-assume list
Profiles that exist in .netrc-longterm: /home/someone/.netrc-longterm
- default
- sub

$ git-assume assume sub
Are you sure you want to overwrite /home/someone/.netrc with profile `default`? [Y/n] Y
INFO - Successfully wrote to .netrc: /home/someone/.netrc

$ git pull origin main
Already up to date.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

The MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_assume-1.0.3.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

git_assume-1.0.3-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file git_assume-1.0.3.tar.gz.

File metadata

  • Download URL: git_assume-1.0.3.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for git_assume-1.0.3.tar.gz
Algorithm Hash digest
SHA256 79278fe460da70625a311e97f7b95806e1032d961e04f317cd28a0b4d42c1fd1
MD5 7e5947dbfc66095ba676f0a949a6b5fb
BLAKE2b-256 2d250672ed770bd2472c2ea1fdb2c11eed5a86df177838ccfc78321216f25472

See more details on using hashes here.

File details

Details for the file git_assume-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: git_assume-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for git_assume-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0db45e7faf8335b2df1ed122bdefae77e41531d34e0ce80f3e0d8afd29a2d4f5
MD5 d99229f1e55502c24ebe8193e9c32da7
BLAKE2b-256 93a68bceb737a6fa0555c7d982a2811e56b942ac1921d91d561905cd47562930

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page