Condividi tramite


Set Environment Variables (Team Explorer Everywhere)

Your operating system maintains a set of dynamic values, which are named environment variables, to provide configuration and status information. You can set an environment variable temporarily for a single shell or command prompt. You can also set the variable to persist so that it affects all future shells or command prompts. This topic focuses only on how to set persistent environment variables on UNIX, where the variables and their values are stored in shell initialization scripts in the user's root directory.

Here are a few examples of environment variables that affect Cross-platform Command-Line Client for Team Foundation Server:

Environment Variables

Description

TF_AUTO_SAVE_CREDENTIALS

Save credentials provided by command-line options or at the interactive prompt to the credentials cache when the variable is set to any value, such as “1”.

TF_DIFF_COMMAND

Compare files for the tf diff command when set to a specific value. For example, TF_DIFF_COMMAND=“/usr/local/bin/visual_diff %1 %2”.  

For more information about how to format the environment variable and its arguments, run tf help diff command.

TF_MERGE_COMMAND

Merge files and resolve conflicts between changed items for the tf resolve command when set to a specific value. For example, TF_MERGE_COMMAND=“/usr/local/bin/visual_resolve %1 %2 %4”. 

For more information about how to format the environment variable and its arguments, run tf help resolve command.

http_proxy

Specify the value to use as the HTTP proxy for all connections. For example, HTTP_PROXY=“http://proxy.mycompany.com:8080/”.

https_proxy

Specify the value to use as the HTTPS proxy for all connections. For example, HTTPS_PROXY=“https://proxy.mycompany.com:8080/”.

no_proxy

Determine hosts that should bypass the proxy. For example, NO_PROXY=”localhost,.mycompany.com,192.168.0.10:80”

TF_ACCEPT_UNTRUSTED_CERTIFICATES

Accept untrusted SSL certificates when the variable is set any value, such as “1”.

Setting Variables on UNIX

The following examples demonstrate how to add an environment variable that is named “NAME” on UNIX by editing different files. You can substitute “NAME” and “value” with a specific name and value for the environment variable.

  • sh: Open the file ~/.profile in a text editor, and add two lines of text at the end of the file, as the following example shows:

    NAME=”value”

    export NAME

    Save and close the file.

  • bash/zsh/ksh: Open the file ~/.bashrc (bash), ~/.zshrc (zsh), or ~/.profile (ksh) in a text editor, and add a line of text at the end of the file, as the following example shows:

    export NAME=”value”

    Save and close the file.

  • csh/tcsh: Open the file ~/.cshrc (csh) or ~/.tcshrc (tcsh) in a text editor, and add a line of text at the end of the file, as the following example shows:

    setenv NAME “value”

    Save and close the file.

All new shells for your UNIX user will have the environment variable that is named “NAME”. If you do not want it to affect future programs, remove the text from the initialization file that you edited, log out from a shell, and then log back in. The “NAME” environment variable will no longer exist.

See Also

Concepts

Cross-Platform Command-Line Client- Beginner's Guide

Command-Line Authentication for Team Explorer Everywhere