问题
I am trying to access perforce and perform Sync operation from command line on Mac machine OS x 10.8.5
Can any one tell me how to access perforce for command line.
I have placed p4 client in /usr/bin directory,
From Terminal when i execute command : P4 or p4 help, im getting below error message.
Perforce client error: Connect to server failed; check $P4PORT. TCP connect to perforce:1666 failed. nodename not servname provided, or not known
Step by step approach to set up Perforce, will be greatly appreciated
Note: P4V gui version is working fine, I need to execute Sync command from Command line for bash script.
Thanks in advance.
回答1:
In addition to downloading the 'p4' executable and placing it in your path (which you have already done), you need to set three configuration settings:
- P4PORT, which is the network address of your Perforce server
- P4USER, which is your user name that you will use to connect to Perforce
- P4CLIENT, which is the name of the workspace that you use on this workstation
You have already figured these out in P4V, as part of entering the data in the connection dialog. But you need to set these variables separately for the command line to know about them.
For example, I might do:
- p4 set P4PORT=myserver.example.com:1666
- p4 set P4USER=bryan
- p4 set P4CLIENT=bryan-dev
and then I would be able to connect with the command line to my Perforce server.
Instead of 'p4 set', you can also use 'export' in your shell:
- export P4PORT=myserver.example.com:1666
- export P4USER=bryan
- export P4CLIENT=bryan-dev
Or you can use a P4CONFIG file.
Bottom line: set P4PORT, P4USER, and P4CLIENT to match the settings that you use in your P4V connection dialog, and the command line will be ready to go.
来源:https://stackoverflow.com/questions/25640366/how-to-connect-perform-sync-with-perforce-on-mac