Hello, 
I'm trying to manually implement Github's Squash&Merge functionality.
After looking many forums like stackoverflow.com I'm still struggling with the issue.

The scenario is as follows:
- master is a protected branch (configured on github)
- a service user svc is permitted to push to master (configured on github)
- other users don't have such permissions
- github PR status check is set to SUCCESS before execution of any set of git commands below

1. This merges successfully without squash:
git checkout origin/master
git merge ${PR-Branch}
git push origin HEAD:master
git push origin --delete ${PR-Branch} 
 
2. This closes the PR, but there is no update seen on master:
git checkout origin/master
git merge --squash --commit ${PR-Branch}
git push origin HEAD:master
git push origin --delete ${PR-Branch}

3. This fails to push to master with the error "GH006: Protected branch update failed"  (despite that the PR is set to SUCCESS):
git checkout origin/master  
git merge --squash ${PR-Branch}
git commit -am"comment"
git push origin HEAD:${m_mainBranch}
git push origin --delete ${m_prBranch}


Will appreciate your help on this.

Thanks,
Vadim