D0vev
D0vev

Reputation: 159

Using Github, CakePHP 3 and Composer

I am trying to find the best way to work with CakePHP 3 on GitHub with multiple workstations.

Scenario: I have installed CakePHP 3 with Composer into a fresh directory and created a git repository from it with the github cli. Using the default .gitignore delivered with cakephp. After pushing the repo to the remote server I started to work on that project.

Later at home I wanted to continue the work and ran into the following problem: Both, Composer and GitHub (CLI and GUI) need a empty folder to install the cakephp core or clone the repo. So, what would be the best way to deal with that problem without deleting the .gitignore and push the whole cakephp core to the repo?

Upvotes: 0

Views: 1361

Answers (2)

Ozzy
Ozzy

Reputation: 8322

When you pull from github on another machine:

  1. Install composer globally: curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
  2. Clone your repo from github e.g. git clone [email protected]:myuser/cakephpapp.git cakeapp
  3. Go into your repo e.g. cd cakeapp and then run composer install

Your bin folder will be missing unless it was committed to your repository. You can get another copy by creating a new cakephp app and then copying it:

  1. Create new cakephp app: composer create-project --prefer-dist cakephp/app tempapp
  2. Copy the bin directory: mv tempapp/bin/ ./bin
  3. Remove the new app: rm -rf tempapp/

If you've accidentally upgraded your packages or altered your composer.lock file (and have no code changes) you can reset the repo without removing bin/ (this should be in your .gitignore)

  1. git reset --hard HEAD
  2. git pull origin master

Upvotes: 0

Alimon Karim
Alimon Karim

Reputation: 4469

If composer globally installed in your home computer, after clone just use below command in your project folder.

composer update

This command need only 1st time. Then cakephp core will download automatically.Then it will work fine.I think it's an easy solution.

Complex solution is,you can change git ignore file, then create repo, after clone in your home computer change again git ignore file.

Upvotes: 1

Related Questions