How can I connect my Bitbucket repository with Cribl?
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
-
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
andREADME.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
andgit 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/masterThen 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 masterThis 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.
1
Answers
-
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
andREADME.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
andgit 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/masterThen 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 masterThis 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.
1 -
Thank you very much for the answer. That solves my problem!
0