clone - Clone Shop Files

Download shop files from the target environment to your local development machine.

Purpose

The clone command downloads the complete shop codebase from your configured PrestaShop Enterprise environment, setting up the local file structure needed for development.

When to Use

  • New environment setup: Setting up a new local development environment
  • Code updates: Getting the latest deployed version from the remote environment
  • Project switching: Starting work on a different project or environment
  • Fresh start: Getting a clean copy of the shop files after local modifications

Prerequisites

Before running the clone command:

  1. Authentication: Must be authenticated with ps-enterprise auth
  2. Configuration: Must have valid environment configuration from ps-enterprise config
  3. Remote Dump: It is required to run remote-dump to get the database state
  4. SSH Access: Must have access to GitLab repository

Usage

Basic Clone

ps-enterprise clone

Force Overwrite

# Force overwrite existing local files
ps-enterprise clone --force

Options

Flag Short Description Required
--force -f Force overwrite existing files without confirmation No
--help -h Show command help No

Process

1. Clone git indexed files

  • Connects to GitLab using SSH keys
  • Identifies the correct repository and branch/tag for the targeted project environment

2. Download git ignored files

  • Retrieves .devtoolkeep rules
  • Downloads all shop files and directories

Examples

Initial Project Setup

# Set up new project from scratch
mkdir my-prestashop-project
cd my-prestashop-project

# Configure project
ps-enterprise auth
ps-enterprise config
ps-enterprise remote-dump

# Clone files
ps-enterprise clone

Update Existing Project

# Get latest changes from remote environment
cd existing-project
ps-enterprise clone

# If you have local modifications:
# The command will warn you about overwriting files
# Use --force to proceed or backup your changes first

Force Clean Clone

# Overwrite all local files with remote version
ps-enterprise clone --force

# ⚠️  Warning: This will overwrite local modifications

Success Indicators

After successful cloning:

✓ Connected to GitLab repository
✓ Repository cloned successfully
✓ Local file structure created
✓ Files ready for local development

Troubleshooting

SSH Authentication Failed

❌ SSH authentication failed: Permission denied (publickey)

Solution:

  1. Generate SSH keys: ssh-keygen -t ed25519 -C "your-email@example.com"
  2. Add key to GitLab: Copy ~/.ssh/id_ed25519.pub to GitLab SSH keys
  3. Test connection: ssh -T git@gitlab.prestashop.com

Repository Not Found

❌ Repository not found or access denied

Solution:

  • Verify project configuration with ps-enterprise config
  • Contact administrator for repository access
  • Ensure you have developer access to the project

Local File Conflicts

⚠️  Local files exist. Overwrite? (y/N)

Options:

  • y - Overwrite local files with remote version
  • N - Cancel clone operation
  • Use --force flag to skip confirmation

Insufficient Disk Space

❌ Clone failed: No space left on device

Solution:

  1. Check available disk space: df -h
  2. Free up space by removing unused files
  3. Consider using ps-enterprise clean on other projects

Integration with Other Commands

The clone command integrates with other CLI commands:

  • Requires: Valid authentication (auth) and configuration (config)
  • Followed by: Usually followed by patch to apply local environment settings
  • Works with: start command uses cloned files to run local environment
  • Cleanup: clean command removes cloned files
  • auth - Required for GitLab access
  • config - Determines which repository to clone
  • patch - Apply local environment settings after cloning
  • clean - Remove cloned files

Important: The --force flag will overwrite existing local files without confirmation. Always backup important local changes before using this flag.
Pro Tip: Use git status in your project directory to see which files have been modified locally before running clone with --force.
SSH Setup: Make sure your SSH keys are properly configured in GitLab before running the clone command. Test with ssh -T git@gitlab.prestashop.com.