Search code examples
herokucontinuous-integrationdevopscodeship

How to prevent git push heroku master?


My workflow encompasses the following steps:

  1. Git push (to BitBucket or GitHub depending on the project).

  2. BitBucket/GitHub is integrated with CodeShip, tests are run.

  3. If tests are ok, CodeShip automatically deploys to Heroku.

Everything works fine when, by pushing to the remote repo, the deployment tasks are triggered which ends up with the new version going live when everything is ok.

My question is:

Sometimes, I simply do a git push heroku master which defeats the whole purpose of this workflow.

How can I prevent it from happening? Is there a way to make Heroku only accept the deploy when the source is CodeShip?


Solution

  • After looking around for quite some time, I noticed that there are a some ways to accomplish this, all of them related to simply not giving access to the Heroku Account for the developer:

    1. If you're a single developer ("one-man / one-woman show"):

      Do not add the Heroku Remote to your Git Repository. If it is already added, remove it. That way you're not going to push to it by mistake.

    2. If you're managing a team:

      Do not give the team a user/pass to access Heroku Toolbelt. That way, the only remote repo they will have access to should be GitHub/BitBucket/Whatever.