Setting a personal git server

Hi everyone,

Since I am still learning and need some insight, how do you install and setup yii2 including making a git repo so I can work from different computer and commit my work?

My steps are:

  1. Install yii2 advanced using composer into localhost computer first.

  2. Create a new repo (using bitbucket) server, push everything from local to git server.

  3. Using other computer to set up git connection and pull everything.

I thought I am done, I realized something that installing yii2 with composer or from archive contains gitignore for some files. So when I do git pull on the other computer, I cannot run the webapp due to some missing files.

Is it a bad thing if I remove the gitignore file, or its there for a good reason? How do you do it if you want to work on your web remotely?

For my own, i never needed to delete that file and can work normally. Which files are missing on your remote repository ?

Mostly index.php file in frontend/web or backend/web folder.

The .gitignore in the that folder contain this:


/index.php

/index-test.php

and in the based directory .gitignore file contain:


# yii console command

/yii


# phpstorm project files

.idea


# netbeans project files

nbproject


# zend studio for eclipse project files

.buildpath

.project

.settings


# windows thumbnail cache

Thumbs.db


# composer vendor dir

/vendor


# composer itself is not needed

composer.phar


# Mac DS_Store Files

.DS_Store


# phpunit itself is not needed

phpunit.phar

# local phpunit config

/phpunit.xml

I searched there are about 31 files of .gitignore in various places.

Applications built on the advanced template must be initialized after a fresh checkout in a new environment because the initialization script generates some files, like frontend/web/index.php and backend/web/index.php, with environment specific content (and that’s why these files are git-ignored).

I use Deployer, and wrote a blog post about using it to deploy Yii applications: Deploying Yii with Deployer

For Deployer with the advanced template, check out my yii advanced deployer project template: https://github.com/jacmoe/yii2-app-advanced-deployer