How to log in as a user in p4
I have an issue where users are trying to log in to their Perforce account using p4
command line (not p4v
visual client), but it seems to start at a default account without permissions. When they try to logout with
p4 logout
the users get following error
开发者_运维知识库"Access for user "foo" has not been enabled by 'p4 protect'".
What is the standard way of logging out and logging in via p4
command line?
For ease of use, make sure to set your username via the P4USER environment variable first, then use p4 login
and p4 logout
You could also use p4 -u <username> login
The following command fixed my problems. It is definitely what a flat described above but I am spelling it out for those who get confused with the extra comments and information.
For Windows and Mac OS X user
p4 set P4USER=<username>
For Linux users as there is no registry to store values of environment variables
export P4USER=<username>
you can then use
p4 info
to verify that the new username is being used.
For me p4 -u username login
worked, but when I tried to run other commands like p4 sync
it was using the local username, so I used p4 -u username sync
, it appears to work. I think every p4
command should start with p4 -u username
To fix
*"Access for user 'foo' has not been enabled by 'p4 protect'."
Edit the permissions table and give the group that they're in access to read something.
If you're on Unix you can login as an admin account and run:
p4 protect
This will open the "Protections:" table in a text editor.
Add this at the bottom:
read group foo-group * //foo/...
(where foo-group is a group that foo is in, and //foo/... is a depot you want foo-group to have read access to)
NOW the user foo should be able to login.
精彩评论