Can I do ALIAS for the Travis YAML configuration command? ... "travis encrypt GITHUB_TOKEN = ****** --add"?

I have a Github Personal Access Token icon that I use in many of my projects. Since the token has read / write capability for all of my repositories, it is important to use the Travis Command Line Tool to encrypt GITHUB_TOKEN and place it in my .travis.yml as a safe variable:

 travis encrypt GITHUB_TOKEN=****secret**** --add 

Problem

  • The GITHUB_TOKEN value is a hard-to-remember string of random characters, so every time I need it, I have to find it first, then copy n 'paste it into git bash.
  • Whenever I use the travis encrypt method, it associates GITHUB_TOKEN with ONLY in the repository I am in.

enter image description here

Question

Can this travis command be made an alias that I can use again and again?

 [alias] git repo-encrypt = "travis encrypt GITHUB_TOKEN=****secret**** --add" 

If so, how and where?

+1
git environment-variables encryption travis-ci
source share
1 answer

An easy way to add an alias is to run this single-line interface:

 git config --global alias.repo-encrypt '!travis encrypt GITHUB_TOKEN=****secret**** --add' 

Alternatively, you can run git config --global --edit to open the global Git configuration in a configured text editor (controlled by the core.editor Git configuration value). Then add the following to the file:

 [alias] repo-encrypt = "!travis encrypt GITHUB_TOKEN=****secret**** --add" 

After adding an alias, running git repo-encrypt will execute the Travis command. For future reference, starting with a Git alias with ! , it executes the command as if it were a regular shell, instead of simply adding an alias to the end of the git command, as usual.

See the Git page of the SCM book on aliases for more information.

+2
source share

All Articles