Skip to main content

Add your description here

Project description

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

pytest

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.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

git_assume-1.0.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_assume-1.0.0.tar.gz
  • Upload date:
  • Size: 6.4 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.0.tar.gz
Algorithm Hash digest
SHA256 4aecdc8c66fec3b6a5f5a467f463d253b8a12f4a6a5b6cc7ad44819abc279670
MD5 c651cf71224457308f1e911f9eb4dc3c
BLAKE2b-256 951a5f92ea432bc66dd88f46fe5a800f6c4e632660b8ee63e1d681ca48c4abd5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_assume-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2676199216d9eb9dd804d736e32d9fbb0acadfed726aecc82feef9f9bf53652a
MD5 0072ced694b061eec8a8a1bdc154c2f9
BLAKE2b-256 d85c35c5d4094a0e92ab5f787076e5a4258c5406ef42ba755c39c5feb40368c0

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