Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 Server Administration Documentation | 2025.2

# Run p4 clone

Here is the `p4 clone` command syntax:

    p4 [-u user] [-d dir] [-c client] clone [-m depth] [-v] -p port -r remote
    p4 [-u user] [-d dir] [-c client] clone [-m depth] [-v] -p port -f filespec

p4 clone includes a number of command-line arguments:

- The `-d` option specifies the directory where you want to create the server’s files. If you don’t specify this option, the files are created in the current directory.
- The `-p` option specifies the address of the shared server you wish to clone from. The `-p` preceding `P4PORT` is optional. If not specified, `p4 clone` uses the shared server specified by the `P4PORT` environment variable. See P4PORT meaning before and after a clone for a discussion of how `P4PORT` has a different meaning before and after a clone.
- The `-m` option performs a shallow fetch; only the last number of specified revisions of each file are fetched.
- The `-r` option specifies the remote spec installed on the shared server to use as a template for the clone and stream setup. You can obtain the name of the desired remote from the shared server administrator or run the `p4 remotes` command against the shared server to obtain a list of candidates to choose from. At the time of cloning, P4 Server will copy the remote from the shared server to the personal server and name it `origin`. For more information on remotes, see Remotes, an overview.

- The `-f` option specifies a filespec in the shared server to use as the path to clone; this path will also be used to determine the stream setup in the personal server. You can specify the `-f` option or the `-r` option but not both.

  It is optional to specify the `-f` string on the command line. Instead, you can simply follow `*`p4 clone`*` with `_filespec_`.

- The `-v` option specifies verbose mode.
- The `-c` option lets you customize the name of the stream that `p4 clone` creates.

Your search for returned results