cp: target '/path/to/directory' is not a directory

Viewed 80

I really confused by target /path/to/directory is not a directory when i want to copying all files in build/* to the direction in by this rule in gitlab-ci.yml file:

 script:

    - cp -rf build/* /path/to/directory

I've also check this command by removing/adding / at end and start of the destination but won't help.

Note: it's OK when i manually run the cp command in server terminal and have no problem with it.This command was successful when i run it manually through terminal in ubuntu server.

So what's the problem here?

1 Answers

it's OK when i manually run the cp command in server terminal and have no problem with it.

That is probably because the target folder exists in the server itself, while it might not exist in the context of the GitLab runner.

You should either:

Related