Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Bitbucket pipeline to Heroku fails "Push rejected, source repository is a shallow clone."


I have a pipeline to Heroku app cloud for nodejs based frontend app.



Dont know how to fix this...

.yml file looks like this:

# This is a sample build configuration for JavaScript.
# Check our guides at for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:10.5.0

- step:
# set HEROKU_API_KEY and HEROKU_APP_NAME environment variables
# set clone `depth: full' as described here:
name: Deploy Koneviesti frontend to Heroku
# deployment: test # set to test, staging or production
# trigger: manual # uncomment to have a manual step
- git push https://heroku:$$HEROKU_APP_NAME.git HEAD:master


The problem comes from pipeline run:

git push https://heroku:$$HEROKU_APP_NAME.git HEAD:master
+ git push https://heroku:$$HEROKU_APP_NAME.git HEAD:master
remote: ! Push rejected, source repository is a shallow clone. Unshallow it with `git fetch --all --unshallow` and try pushing again.
To https://heroku:$$HEROKU_APP_NAME.git
! [remote rejected] HEAD -> master (shallow update not allowed)
error: failed to push some refs to 'https://heroku:$$HEROKU_APP_NAME.git'

4 answers

Fixed same problem by adding
git filter-branch -- --all
before the git push

It's works!!!!!   

This worked for me as well.


Does this line need to stay in the pipeline.yml file or can it be removed? (not sure if it's a one-time fix or if it needs to be there long-term)

By default git clone takes only last 50 commits, so if there is more changes in pipeline since last deploy, you should set to pipelines depth to full



    enabled: true

    depth: full

see in section `depth`


This works for me! Thanks!

@rich @Marko Melko 

try my solution

- step:
- apk add git openssh-client
- git remote add [name] <repo_url>
- git remote -v
- git pull
- git checkout [branch]
- git filter-branch -- --all
- git push -u sync [branch]

Work for me 

I fixed this with clean repository and all worked very nicely.

GIT has goon to the "node" :)

When creating pipelines, remember to have fundamentals right. Then add pipeline setting and needed configurations for both ends. I know now this case, so remember to i.e. email me if have problems with heroku&bitbucket -

Do you have idea what was the problem? I encountered this and don't want to clean the repo

@Marko Melko Can you share your final solution in .yml?

Like Matthew Palmer likes this

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events