Wednesday, September 24, 2014

Perforce login with ticket

The perforce server may doesn't accept the actual password as argument with -P option as shown below

bash-3.2$  p4 -u myuser -P mypassword changes -m1
                  Perforce password (P4PASSWD) invalid or unset.

But the password supplied with -P (mypassword) works, if you type it with below command
bash-3.2$ p4 login
Enter password: mypassword

User myuser logged in.

You may need to authenticate to Perforce server from scripts during automation. The alternative way to login is pass the ticket value instead of password with -P option.

How to get the ticket value?

bash-3.2$ p4 login -a -p
Enter password: ******
ABCD1234EFGH5678IJKL1234MNOP5678

You'll get a 32 character length ticket value. Use it as password along with -P

bash-3.2$  p4 -u myuser -P ABCD1234EFGH5678IJKL1234MNOP5678 changes -m1
                   Change 12345 on 2014/09/24 by idiot@idiot_box 'UI bug fix'

The above command works !!

No comments: