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

P4 CLI Reference | 2025.1

# p4 clone

Clone a new local P4 Server from a remote server.

## 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

Syntax conventions

## Description

When you clone from a remote server, you copy the portion of its contents that you want to work with into your local server.

## Options

`-c client` | Specifies the client name. If not specified, defaults to the name established with the `p4 init` command.
`-d directory` | Specifies the directory in which the new P4 Server is initialized. If not specified, defaults to the current directory.
`-f filespec` | Specifies a filespec in the remote server to use as the path to clone. The P4 Server uses this path to determine the stream setup in the local server. P4 Server also uses this file specification to determine the stream setup in the personal server. Specifying the filespec also creates a default remote spec called `origin`. The `-f` preceding the filespec is optional. You can simply issue the command `p4 clone //file/path`.
`-m depth` | Specifies the maximum number of revisions of each file to clone; a shallow clone.
`-p port` | Specifies the address (`P4PORT`) of the remote server you wish to clone from. This flag is optional. If not specified,`p4 clone` uses the remote server specified by the `P4PORT` environment variable.
`-r remotespec` | Specifies the remote spec call remotespec installed on the remote server to use as a template for the clone and stream setup.
`-u username` | Specifies the P4 Server user.
`-v` | Enables verbose mode.

## Usage notes

Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required
--- | --- | ---
N/A | N/A | read on the remote server.

## Examples

`p4 -u bruno -d Ace clone -p perforce:1666 -f //depot/main/...`

As user `bruno`, clone the server `perforce:1666`, retrieving only the files and history from the remote server path `//depot/main/...`

## Related commands

To initialize a P4 Server | `p4 init`

Your search for returned results