Setting remote and branch in appleboy/drone-git-push does nothing

Hi,
I want to incorporate the following into my pipeline:
When a bunch of testing has been completed and accepted, I want to merge the contents of that testing branch into another branch, and push it to my remote repo. This is my latest attempt, but I keep either getting the following when I introduce manual commands to the image (1)

Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

or this when I try to use the built-in attributes found in the docs (2)

+ git push deploy HEAD:master
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
exit status 128

It looks like setting the remote, branch etc doesn’t change the default value (deploy HEAD:master), and despite the user where the ssh key is registered at being a collaborator with write access to the repo, I keep getting permission denied. Has anyone done anything similar and knows what could be up?


(1)

  - name: merge
    image: docker:git
    commands:
    - git fetch origin branch1:branch1 branch2:branch2
    - git checkout branch2
    - git merge branch1

  - name: push
    depends_on:
    - merge
    image: appleboy/drone-git-push
    remote_name: origin
    branch: branch2
    local_branch: branch2
    remote: [email protected]:owner/repo.git
    key:
      from_secret: ssh_key
    commands:
    - git remote set-url origin [email protected]:owner/repo.git
    - git push origin branch2

(2)

  - name: merge
    image: docker:git
    commands:
    - git config user.email "[email protected]"
    - git config user.name "Foo Bar"
    - git fetch origin branch1:branch1 branch2:branch2
    - git checkout branch2
    - git merge branch1

  - name: push
    depends_on:
    - merge
    image: appleboy/drone-git-push
    remote_name: origin
    branch: branch2
    local_branch: branch2
    remote: [email protected]:owner/repo.git
    key:
      from_secret: ssh_key

all plugin settings need to be placed under the settings section. for example:

- name: push
  image: appleboy/drone-git-push
  settings:
    remote_name: origin
    branch: branch2
    local_branch: branch2
    remote: [email protected]:owner/repo.git
    key:
      from_secret: ssh_key
1 Like

Sweet, thanks Brad.
I was thinking that might be it, but then the examples in the docs didn’t (however I noticed they have an issue regarding upping to 1.* so that might be it).

I’ll try it out and mark as solved if it works, or if something new arises I’ll update.

That did indeed solve my first issues, but I still keep getting

Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
exit status 128

I’ve tried adding the private key into the GUI, referring to it as a normal secret the way described above, and via the cli, as described in the docs (though that step also seems to refer to a previous version of the cli, so the command is not identical).

drone secret add --name GIT_PUSH_SSH_KEY --data id_rsa user/repo

I confirmed that the key in question is valid, as I was able to use the same private key to push to that account manually.
Any ideas?

sorry, for that you will have to work with the plugin author for support

Yeah, I’ll try that.

Edit:
If anyone runs into a similar thing, I’ve opened appleboy/drone-git-push#37 regarding the issue.