how to set automatic git pull from bitbucket and complie project on ec2 instance create event with auto scaling
You want to make use of user_data scripts.
It's basically a bootstrap shell script that gets executed on an instance during launch.
You can embed your app configuration script in there (either directly via bash, or have it call your configuration management software like Ansible or Chef).
Then, if you attach this script to a Launch Template or a Launch Configuration (which is an instance template required as part of an AWS ASG), it will be applied to the whole autoscaling group.
Then, when you have a scaling event, any new instances that come up in the ASG will run the script and deploy your code.
However, I would recommend you look into immutable infrastructure instead.  I.e. set up automation (i.e. via Packer) that builds your application code into your AMI, with user_data only used for actually starting the app.
Then, when you have a new build, have the same automation build a new AMI and replace your ASG (note you'll need to have your ASG created/deployed in a programmatic fashion.. I personally recommend Terraform).