Getting error with a git command on teamcity which is working fine in the local environment
I am trying to run a git merge-base and git diff command in MATLAB scripting environment where in I want to extract the differences between my current git commit and git commit from the start of branch, the commands I am using are as follows:
[status,cmdout] = system('git merge-base <branch name> origin');
When I am running this command in my local pc, it is working fine and giving me the commit id from which the branch is getting created. However, when I am running the same command on TeamCIty, it is not recognizing the keyword ‘origin’. - following error I am getting - fatal: Not a valid object name origin.
Can you please guide me as to why TeamCity is not able to recognize the keyword origin ? Please let me know.
Please sign in to leave a comment.
Before the build, the TeamCity build agent creates a directory and checks out the repository there. For the location of the checkout directory, see https://www.jetbrains.com/help/teamcity/build-checkout-directory.html#Checkout+Directory+Location
All the work with the repository now runs in this shallow clone of the git repository. You can cmd in this checkout directory and try `get merge-base <branch name> origin` there, it will fail with the same error.
You can run `git branch -r` in this checkout directory to see available as `merge-base` objects remote branches.
Best regards,
Anton