I have two Perforce workspaces on my computer, one at c:\dev
and second at c:\code
. When I run p4 status
in c:\code
I get an error message
Path 'c:\code\...' is not under client's root 'c:\dev'
The same happens for p4 reconcile
. How can I get the commands to work? It's obvious it's trying to run the command against the wrong repo.
If you don't explicitly set the P4CLIENT
environment variable, Perforce uses the default workspace. How it decides which workspace is the default, I do not know. Anyway, it has defaulted to the one whose root you have mapped to C:\dev
. You need to switch to workspace code
(or whatever its actual name is). At the command line type the following command to switch workspaces:
p4 set P4CLIENT=[client name]
Of course, you'll replace "[client name]" with the name of the workspace whose root you have mapped to C:\code
.
Expanding a bit on raven's answer. By default, if you don't set P4CLIENT, perforce takes your machine name as the default client name. So if you want to use another client, you have to use the p4 set P4CLIENT=[client name]
, which will set it for every instance of p4 you run, no matter which command window you are in. You can can also do a set P4CLIENT=[client name]
on the command line, which will only be valid in the command window that you are running in.
In addition, you can use p4 -c [client_name] <command>
since -c is a global option, you can supply it to all p4 commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With