• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. Skara
  4. CLI Tools

Page History

Versions Compared

Old Version 3

changes.mady.by.user Erik Helin

Saved on Mar 09, 2020

compared with

New Version 4

changes.mady.by.user Erik Helin

Saved on Mar 09, 2020

  • Previous Change: Difference between versions 2 and 3
  • Next Change: Difference between versions 4 and 5
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You already have a Git credential manager in Keychain, there is nothing to install or configure.

GNU/Linux

GNOME

On GNU/Linux the recommended setup is to use libsecret and the "libsecret credential helper" in order to use GNOME Keyring as the Git credential manager. If you are using a desktop environment or distribution without support for GNOME Keyring, please see the "Manual" Other section.

Fedora

Fedora 29 and 30 (the only two currently supported versions of Fedora) comes with libsecret and GNOME Keyring installed by default. When you install the git package you also get the libsecret credential helper installed. To configure git to use the libsecret credential helper run:

...

Code Block
languagebash
sudo dnf install seahorse
Ubuntu

Ubuntu 19.04 and 18.04.2 (LTS) (the only two currently supported versions of desktop Ubuntu) comes with libsecret and GNOME Keyring installed by default. Unfortunately even if you install the Git package you will not get a binary version of the libsecret credential helper installed (you only get the source). This means you have to compile the libsecret credential helper yourself. This is easy to do, it just requires two extra commands:

...

Code Block
languagebash
$ sudo apt install seahorse

...

Other

If you are using a desktop environment or distribution without support for GNOME Keyring, or if you want to use your own scheme for storing the PAT, then that is also supported. You can store non-sensitive data such as your username and the URL of the Git source code hosting provider in your ~/.gitconfig file in the "credential" section:

Code Block
languagebash
[credential "https://github.com"]
username = foobarYOUR-GITHUB-USERNAME

For the PAT itself, all Skara tools interacting with an external Git source code hosting provider's API supports the GIT_TOKEN environment variable. This means that instead of storing your PAT in a secure way in a Git credential manager you will have to secure the PAT according to your security requirements. The following sections give a few examples on how to secure the PAT depending your security needs.

GPG

You can use GnuPG (GPG) to store your PAT in an encrypted file. The file can be encrypted either using a GPG key or using a passphrase. If you have a GPG key you probably already know how to encrypt a file with it, so we will only cover encrypting using a passphrase here. To encrypt the PAT in a file using a passphrase, run the following command (replacing <PAT> with your personal access token):

Code Block
languagebash
$ echo '<PAT>' | gpg --symmetric -o ~/pat.gpg
Enter passphrase:
Repeat passphrase:

When using applicable Skara CLI tools it e.g. encrypted on disk using gpg and then set the GIT_TOKEN environment variable to the decrypted value when , for example:

Code Block
languagebash
GIT_TOKEN=$(gpg --decrypt ~/pat.gpg) git pr list
age

You can use age to store you PAT in an encrypted file. To encrypt the file using a passphrase, run the following command (replacing <PAT> with your personal access token):

Code Block
languagebash
$ echo '<PAT>' | age --passphrase > ~/pat.age 

When using applicable Skara tools. For CLI tools set the GIT_TOKEN environment variable to the decrypted value, for example:

Code Block
languagebash
$ GIT_TOKEN=$(gpgage --decrypt ~/pat.gpgage) git pr list
File Permissions

Warning

This is not as secure as storing the personal access token encrypted. Any person or program who can read ~/pat.txt will be able to read your personal access token and impersonate you.

A non-secure way to restrict access to your PAT is to store it in plain-text but accessible read-only to the current user. To store your PAT, run the following commands (replacing <PAT> with your personal access token):

Code Block
languagebash
$ echo '<PAT>' > ~/pat.txt
$ chmod 0400 ~/pat.txt

When using applicable Skara CLI tools set the GIT_TOKEN environment variable:

Code Block
languagebash
$ GIT_TOKEN=$(cat ~/pat.txt) git pr list

Creating a Personal Access Token

...

Overview
Content Tools
ThemeBuilder

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.23
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 401, "requestCorrelationId": "392fc4d7f288bacc"}