Skip to main content

netrcli - cli for .netrc file

netrcli is a small command line tool to work with entries in .netrc file. As the .netrc file support is implemented in many tools, like ftp, curl, pip, and wget, this tool targets to help the use of those tools with authenticated services, like GitLab.

The credentials are stored in plaintext in the .netrc file.

This is the way .netrc is. You have been warned.

In the background netrcli extends python standard library netrc implementation.

Installation

Install the command line tool from with pipx:

pipx install netrcli

Alternatively use pip for the installation:

pip install netrcli

Either way, to check the installation and netrcli version, run:

netrcli --version

If you see a version in the terminal, you're good to go!

Usage

When in doubt, try

netrcli --help

The tool uses ~/.netrc file. If such does not exist, it will be created to the home directory of the current user.

Updating entries in .netrc file

To add or modify the entry of myhost.com in the .netrc file, run

netrcli update --login user@name.com --password qwerty123 myhost.com

Use in GitLab pipelines

To add GitLab credentials in the .netrc file during GitLab jobs, run

netrcli update --gitlab-ci

in the GitLab job. This adds an entry in the .netrc file with using environment variables CI_SERVER_HOST CI_REGISTRY_USER, and CI_JOB_TOKEN. Now you can use for example curl to fetch packages from GitLab package registry with just --netrc argument set.

Note, that curl only supports HTTP basic authentication with the credentials from .netrc file with ``--netrc` argument.

Most of the endpoints in GitLab do not support HTTP basic authentication for authentication, but for example generic package registry does support it.

Get information from .netrc file

To get a stored login (username) to the standard output for a specific host from the .netrc file, run

netrcli get --login myhost.com

And to get the stored password of the host, run:

netrcli get --password myhost.com

Metadata

Release files for netrcli 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netrcli 0.0.1
File Size Uploaded
netrcli-0.0.1.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for netrcli 0.0.1
File Interpreter ABI Platform
netrcli-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / netrcli-0.0.1.tar.gz

Download URL netrcli-0.0.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
625b97d6f6e3c23f3d4be9dc4d05827f9e54bcb83398afc4b9c745567bed5303
BLAKE2b-256 checksum
How to use checksums
e418ac920196c349dcf48fe827ad451af1c1f31d0975a6f44bdc65df221a5879
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / netrcli-0.0.1-py3-none-any.whl

Download URL netrcli-0.0.1-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be66c435c93f7e1485c6579ea85bd7aa5408002505f79eff2f5ffd9654c90e76
BLAKE2b-256 checksum
How to use checksums
4850155fa12dcdc9a3f854a8b240b7a62b37d0b374ce3ce08d79c51e4ecb9797
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release history Release notifications | RSS feed

0.1.0

2 release files

0.0.2

2 release files

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page