Kirby CLI: Can't create kirby installations

Hi all, long-time lurker (and perpetual neophyte love of all things Kirby) here, running into what is likely an obvious CLI hurdle. I hope! I’ve successfully used the command line tool in the past, but for some reason my setup isn’t playing nice with it this time. The CLI will download starterkit, but it won’t subsequently create the new kirby site structure.

I’m using Ubuntu 16.04, with (to my knowledge) everything needed to run a LAMP setup installed. I’ve tried installing composer both with the officially-documented method and through apt. Also please note in the results below that bin folder is known to my PATH (so I can run e.g. composer global update getkirby/cli with no issue). Here’s what happens:

$ kirby install kirby-test-0

Installing the starterkit...
Downloading from: https://github.com/getkirby/starterkit/archive/master.zip
PHP Warning:  mkdir(): Permission denied in /home/james/.config/composer/vendor/getkirby/cli/src/Command.php on line 89

Warning: mkdir(): Permission denied in /home/james/.config/composer/vendor/getkirby/cli/src/Command.php on line 89
PHP Warning:  rename(/tmp//tmp/kirby-getkirby-starterkit-5883bce0293c6/starterkit-master/.gitignore,kirby-test-0/.gitignore): No such file or directory in /home/james/.config/composer/vendor/getkirby/cli/src/Command.php on line 93

Warning: rename(/tmp//tmp/kirby-getkirby-starterkit-5883bce0293c6/starterkit-master/.gitignore,kirby-test-0/.gitignore): No such file or directory in /home/james/.config/composer/vendor/getkirby/cli/src/Command.php on line 93

[RuntimeException]              
.gitignore could not be copied  
                                  
install [-k|--kit [KIT]] [--dev] [--] [<path>]

I’m fairly certain this is elementary server admin stuff; I wish I could figure it out on my own. If you feel you know why this might be happening, I’d greatly appreciate any advice or insight you could provide!

As the error says, this is a permissions problem, the CLI works and downloads the starterkit but then does not have the rights to create a folder.

1 Like

I think you should use sudo: sudo kirby install kirby-test to get the permission for folder creation

1 Like

Thanks y’all! Got it figured out and works like a champ. Now to do a ton more reading on file ownership/permissions…

@kryptondog what is your solution ? I have the same problem.

I still get issues with the CLI even with using sudo. I gave up in the end. My problem was that i run my local server on its own hard drive. The cli downloads and unpacks the files on the root volume ok, but then fails to move them to the other drive even with with sudo. i don’t know if this is a problem with the CLI itself or a feature/flaw of one of its dependicies. sigh.

I think with Linux the rename() function from partition1 to partition2 is not allowed

http://php.net/manual/de/function.rename.php

Thanks for the tip. Im on a mac, so i’m guessing the same is true. Thats that then. Back to git…

https://github.com/getkirby/cli/issues/36

I found a solution it works but maybe not the best way

changed at

Command.php Line 15

  protected function tmp($filename) {
    return '/tmp/' . $filename;
  }



  protected function tmp($filename) {
    return '/home/username/tmp/' . $filename;
  }