Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support authentication #128

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ matrix:
install:
# newer versions of PyYAML dropped support for Python 3.4
- if [ $TRAVIS_PYTHON_VERSION == "3.4" ]; then pip install PyYAML==5.2; fi
- pip install coverage flake8 flake8-docstrings flake8-import-order pytest PyYAML
- pip install appdirs coverage flake8 flake8-docstrings flake8-import-order mock pytest PyYAML
script:
- PYTHONPATH=`pwd` pytest -s -v test
notifications:
Expand Down
39 changes: 39 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,45 @@ The set of repositories to operate on can optionally be restricted by the type:
If the command should work on multiple repositories make sure to pass only generic arguments which work for all of these repository types.


Access repositories that require authentication
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The various version control systems supported by vcstool support authenticated access on their own (e.g. SSH public keys, .netrc files, etc.).
For .tar or .zip repositories, vcstool supports authenticated access by parsing files with a netrc-like format.
It will first look for login information in the `~/.netrc` file, used by ftp, git, and similar programs if it exists.
If it doesn't exist (or doesn't contain login infomation for the URL in question), it moves to vcstool-specific locations.
In these locations vcstool will look for credentials in either an `auth.conf` file, or `.conf` files inside an `auth.conf.d` directory.
These locations are (in order of precedence):

1. User config directory.
- On Linux, abides by XDG spec: `~/.config/vcstool/`
- On macOS: `~/Library/Application Support/vcstool/`
- On Windows: `C:\\Users\\<username>\\AppData\\Local\\vcstool\\vcstool\\`
2. Site config directory.
- On Linux: `vcstool/` subdirectory in any directory within `$XDG_CONFIG_DIRS`, or `/etc/xdg/vcstool/` if unset
- On macOS: `/Library/Application Support/vcstool/`
- On Windows: `C:\\ProgramData\\vcstool\\vcstool\\`

The netrc-like format consists of a few different tokens separated by whitespace (spaces, tabs, or newlines):

- `machine <name>`: Credentials are retrieved by matching the repository URL to this token
- `login <name>`: Login username
- `password <string>`: Login password

For example, to access private GitHub repositories::

machine github.com
login mylogin
password myaccesstoken

Accessing private GitLab repositories looks similar, although no `login` is required::

machine gitlab.com
password myaccesstoken

A word of caution: these files are not encrypted.
Ensure that their permissions do not exceed that which is required.

How to install vcstool?
=======================

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from setuptools import setup
from vcstool import __version__

install_requires = ['PyYAML', 'setuptools']
install_requires = ['appdirs', 'PyYAML', 'setuptools']
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
install_requires.append('argparse')

Expand Down
4 changes: 2 additions & 2 deletions stdeb.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[DEFAULT]
Depends: python-argparse, python-setuptools, python-yaml
Depends3: python3-setuptools, python3-yaml
Depends: python-appdirs, python-argparse, python-setuptools, python-yaml
Depends3: python3-appdirs, python3-setuptools, python3-yaml
Conflicts: python3-vcstool
Conflicts3: python-vcstool
Suite: xenial yakkety zesty artful bionic cosmic disco eoan jessie stretch buster
Expand Down
Loading