2015-10-06 111 views
2

我試圖按照Perforce網站上的this post中的步驟設置P4IGNORE文件。爲什麼Perforce不能在Linux上設置環境變量?

在Linux上,運行

p4 set P4IGNORE=.ignore 

導致以下錯誤消息:

Perforce client warning: 
    Can't set registry on UNIX. 

閱讀p4 set的幫助條目,它似乎只能用在Windows上設置Perforce的變量和Mac OS X.在Linux上,我不得不使用本地shell命令,即

export P4IGNORE=.ignore 

我的問題是:爲什麼p4 set命令在Linux和Windows X操作系統(也是基於Unix的)上都無法運行?

+1

Linux沒有註冊表。 – Barmar

+1

我懷疑我已經知道這個答案,並會根據我的猜測發佈一個答案,但是您使用的客戶端版本是什麼? (p4 -V) –

+0

大家好 - 我正在使用2014.1,所以只有一個版本可以解決問題。我無法控制項目中使用的版本,但很高興知道現在存在解決方法。 –

回答

3

升級到P4 CLI的最新版本(或至少版本2014.2):

Major new functionality in 2014.2 

    Other platforms, such as Linux, will now set an environment 
    file. The environment file is available on all platforms 
    if a P4ENVIRO environment variable is set to a file path. 
    P4ENVIRO will default to a file '.p4enviro' in the user's 
    home directory for systems which do not have system provided 
    facilities. The p4 enviro file can be shared across platforms. 
    The 'p4 set' command can be used to manipulate or inspect 
    this new environment facility. Note that these special 
    'P4_<p4port>_CHARSET' values will only appear in 'p4 set' 
    output for the specified or current P4PORT value. 
    For instance 'p4 -p perforce:4666 set' will report on 
    'P4_perforce:4666_CHARSET' if it is set. 

http://www.perforce.com/perforce/doc.current/user/relnotes.txt

+0

我有一個2016版本。它不工作(再次)。 – DerZyklop

+0

「p4 -V」說什麼,「p4 set(whatever)」是什麼意思? –

2

在Windows上,p4 set更新註冊表。在OS X上,p4 set更新用戶首選項文件。

在Linux上沒有註冊表或首選項,因此環境變量用於默認值。 p4 set不可能更新父shell的環境變量,更不用說讓它們永久存在。您需要編輯一個shell啓動文件來設置環境變量。

相關問題