We have updated our Terms of Service, Code of Conduct, and Addendum.

How can I connect my Bitbucket repository with Cribl?

Oliver Hoppe
Oliver Hoppe Posts: 50 ✭✭
edited October 2023 in Stream

How to connect my Bitbucket repository with Cribl?
Question: When trying to push to a remote git repository created in Bitbucket under a project, I am getting the following error:


This is working for other repositories created under a specific user, but not under a project in bitbucket.

Best Answer

  • Robbert Hink
    Robbert Hink Posts: 17
    edited October 2023 Answer ✓

    When you create a bitbucket repository under a project, it is possible that some files are created in it.

    This can cause some conflicts due to the files that Cribl itself is trying to push to that remote repository. Common files which are created within the repository are .gitignore and README.md.

    When trying to push from Cribl to the remote repository for the first time, you will run into a [rejected] (fetch) exception, because there are files already on the remote repository that still need to be fetched and merged with the local branch.

    The error message suggests some commands to run to resolve the issues. These git commands need to be run on the Leader node's CLI at the $CRIBL_HOME directory (/opt/cribl).

    You can try to do a git pull like is being suggested, but this will result in the same error you are seeing now: [rejected] (non-fast-forward).

    Commands such as git status and git pull origin master --allow-unrelated-histories may tell you that you are running into conflicts:

    From bitbucket.org:project/repo-name
     * branch            master     -> FETCH_HEAD
    CONFLICT (add/add): Merge conflict in .gitignore
    Auto-merging .gitignore
    Automatic merge failed; fix conflicts and then commit the result.

    You can confirm the differences between your local branch and the remote branch.

    Run git branch -a

    root@ab9da26f2f6f:/opt/cribl# git branch -a
    * master
      remotes/origin/master

    Then run git diff --diff-filter=ad remotes/origin/master master.

    This will show all the differences for existing files, where you may have to account for conflicts.

    Ultimately, we just want to keep what we have on the Cribl side, so we can do the following:

    git add README.md
    git add .gitignore
    git commit -m "Resolve merge conflict by overwriting .gitignore and README.md files"
    git push origin master

    This should resolve the conflicts and allow both the local and remote branches to be synced.

    It will now also be possible to commit new changes and push to the Bitbucket repository from within the Cribl UI.

Answers

  • Robbert Hink
    Robbert Hink Posts: 17
    edited October 2023 Answer ✓

    When you create a bitbucket repository under a project, it is possible that some files are created in it.

    This can cause some conflicts due to the files that Cribl itself is trying to push to that remote repository. Common files which are created within the repository are .gitignore and README.md.

    When trying to push from Cribl to the remote repository for the first time, you will run into a [rejected] (fetch) exception, because there are files already on the remote repository that still need to be fetched and merged with the local branch.

    The error message suggests some commands to run to resolve the issues. These git commands need to be run on the Leader node's CLI at the $CRIBL_HOME directory (/opt/cribl).

    You can try to do a git pull like is being suggested, but this will result in the same error you are seeing now: [rejected] (non-fast-forward).

    Commands such as git status and git pull origin master --allow-unrelated-histories may tell you that you are running into conflicts:

    From bitbucket.org:project/repo-name
     * branch            master     -> FETCH_HEAD
    CONFLICT (add/add): Merge conflict in .gitignore
    Auto-merging .gitignore
    Automatic merge failed; fix conflicts and then commit the result.

    You can confirm the differences between your local branch and the remote branch.

    Run git branch -a

    root@ab9da26f2f6f:/opt/cribl# git branch -a
    * master
      remotes/origin/master

    Then run git diff --diff-filter=ad remotes/origin/master master.

    This will show all the differences for existing files, where you may have to account for conflicts.

    Ultimately, we just want to keep what we have on the Cribl side, so we can do the following:

    git add README.md
    git add .gitignore
    git commit -m "Resolve merge conflict by overwriting .gitignore and README.md files"
    git push origin master

    This should resolve the conflicts and allow both the local and remote branches to be synced.

    It will now also be possible to commit new changes and push to the Bitbucket repository from within the Cribl UI.

  • Oliver Hoppe
    Oliver Hoppe Posts: 50 ✭✭

    Thank you very much for the answer. That solves my problem!