Add your description here
Project description
git-assume: A CLI Tool to Switch Your .netrc Configuration
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file git_assume-1.0.1.tar.gz
.
File metadata
- Download URL: git_assume-1.0.1.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | fef22d365451497c2b2b0b256d76472ba7d2b7f2e1ec85d61078dd6ade8180f1 |
|
MD5 | f636d85ab0e4848c58f9f7f69ca3982d |
|
BLAKE2b-256 | 5881c86c543d2e35f4f46247e45061ad1f7bf412fe4e55e8538525f4c108a448 |
File details
Details for the file git_assume-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: git_assume-1.0.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 674766e4f08cb2825ece3eef8b937a397e67f64d05ddbe4790c6941f7be2c9b8 |
|
MD5 | 8651f314fe12e951ec6ed0d7a832e915 |
|
BLAKE2b-256 | aa22a6e6303022c61feedf8386cca66099871080c73063b67eb8b6444761cc67 |