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

commit and pushing code from a plan

Patrick Gibbons September 21, 2018

I work for Charles Schwab and I've run into an interesting issue.  If I clone via the git command line, checkout the development branch, touch a file, add the file, commit the file and then do 'git push -u', I see the change in bitbucket on the development branch after doing a pull from another machine cloned with the development branch, both at work and on the web.  If I clone via a plan in bamboo by selecting a clone task, and then try that same sequence above from a second task in the plan, from my home edition of bamboo here, git complains with the error:

 

"21-Sep-2018 13:38:38 Since Git 2.0, Git defaults to the more conservative 'simple'
21-Sep-2018 13:38:38 behavior, which only pushes the current branch to the corresponding
21-Sep-2018 13:38:38 remote branch that 'git pull' uses to update the current branch.
21-Sep-2018 13:38:38
21-Sep-2018 13:38:38 See 'git help config' and search for 'push.default' for further information.
21-Sep-2018 13:38:38 (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
21-Sep-2018 13:38:38 'current' instead of 'simple' if you sometimes use older versions of Git)
21-Sep-2018 13:38:38
21-Sep-2018 13:38:38 remote: error: refusing to update checked out branch: refs/heads/master
21-Sep-2018 13:38:38 remote: error: By default, updating the current branch in a non-bare repository
21-Sep-2018 13:38:38 remote: error: is denied, because it will make the index and work tree inconsistent
21-Sep-2018 13:38:38 remote: error: with what you pushed, and will require 'git reset --hard' to match 

 

if I do the same  push sequence using bamboo from a task at work, however, the change appears in the log to work:

development -> development

but if I do the pull from another machine thereafter, no change pulls down.  Maybe I'm taking the wrong approach here, but I want to trigger a job that pushes directly to development to update the R package version whenever the development branch moves down via a PR.  I was attempting to add my private rsa key to bamboo, but I'm getting a host-key error that the bitbucket cloud endpoint is not trusted, not sure how to make bamboo trust the cert of bitbucket in the cloud.  My goal was to clone via a bash script using the command line, from the cloud, and try a push that way to investigate whether it's something with the way the clone is being created via  bamboo's custom task.  Can you please advise?  Sorry for being so long winded.

1 answer

0 votes
Patrick Gibbons September 23, 2018

If I run the following sequence from a bash shell, test.sh, I get the expected results:

#!/bin/bash
git config push.default matching
git branch -a
git branch --track development origin/development
git checkout development
git branch -a
cd test
ls
touch sample123.txt
git add sample123.txt
git commit -m "add sample 123"
git push -u

 

If I add the above sequence to a script within a bamboo script, however, the log appears to show a successful outcome, but the file never gets pushed, please advise

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events