Hi All,
I am trying to push the repository to codecommit through bitbucket pipeline. It was working fine .
Now, I am facing an error. the error looks like.
remote: processing ...
remote: Unknown commit d7e9a3fbcef21e0ac40ba142f2f528cd0d3db1b1error: unpack failed: Unknown commit d7e9a3fbcef21e0ac40ba142f2f528cd0d3db1b1
To ssh://git-codecommit.us-west-2.amazonaws.com/<repodetails>
[remote rejected] Development -> Development (unpacker error)
error: failed to push some refs to 'ssh://git-codecommit.us-west-2.amazonaws.com/<repodetails>'
this prevents from pushing to remote AWS codecommit.
Any idea how to solve this. I did check the mentioned commit and its assigned perfectly fine with the author details.
Vimal
@Vimal krishnamoorthy do you mind sharing a snippet from you bitbucket-pipelines.yml file? I haven't used CodeCommit before, however something to consider is that in pipelines, we perform a shallow clone of your repository (to a depth of 50, see the log output from Build Setup).
Its possible that you are now trying to push to CodeCommit without having the full commit history.
Are you able to push the same commit from your local machine? I would also suggest trying to test locally by cloning your repository with a depth of 50 (git clone --depth 50 <your repo>), then try to push to CodeCommit, and see if depth causes it to break.
Yes , You where right. We moved to bitbucket from github recently and this was the reason for not having a complete commit history. And CodeCommit will throw an error in such cases.
I started everything fresh from scratch in bitbucket by creating a new fresh repository and IT WORKED. It was better then wasting time trouble shooting the issue.
THANKS FOR THE HELP. BTW THIS WAS MY yml file.
- step: name: Pushing Repository to AWS codecommit
deployment: staging
script:
- echo $CodeCommitKey > ~/.ssh/id_rsa.tmp
- base64 -d ~/.ssh/id_rsa.tmp > ~/.ssh/id_rsa
- chmod 400 ~/.ssh/id_rsa
- echo $CodeCommitConfig > ~/.ssh/config.tmp
- base64 -d ~/.ssh/config.tmp > ~/.ssh/config
- set +e
- ssh -o StrictHostKeyChecking=no $CodeCommitHost
- set -e
- git remote add application ssh://$CodeCommitRepo
- git push application $BITBUCKET_BRANCH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Vimal krishnamoorthy if you don't mind me asking, what method did you use to migrate over from github? I'm curious to find out how this could have caused issues in this case?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Graham Gatus for anyone else coming across this issue, I ran into the same thing when trying to push directly from a Bitbucket pipeline to a brand new CodeCommit repository.
The issue *does* seem to be the lack of history. To solve the issue I first pushed from my local machine, then subsequent pushes from the Bitbucket pipeline worked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can confirm the issue was `--depth 50` no matter if you already made a commit before, I fix it basically squashing all to one commit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I fix it basically squashing all to one commit
- How to do it? Got into the same problem, and it seems I don't have any idea how to squash it to one commit :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Richard, if you have a long git history then squashing isn't necessarily a good idea.
Solution 1 (recommended): Push your repository from your local machine to CodeCommit manually one time. This will give CodeCommit the full history and ensure that pipelines can push future commits.
Solution 2 (not recommended): Delete your .git folder and force push to your bitbucket repository. This will mean your history is < 50 commits which means the shallow pull that pipelines does will still work for updating CodeCommit. This will squash your history to one commit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use ssh keys you'll need to setup both the sender (pipelines) and the receiver (aws codecommit)
To set up ssh keys for use in pipelines you can consult our documentation here https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html
To set up ssh keys for use in aws codecommit you can consult the documentation here https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html
If you have any other questions let me know.
Cheers,
Abhishek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.