Facing issues with git clone + ssh

I wanted to understand if there is a plugin I can use for github clone + ssh. Was checking for drone-plugins github repo and found this: https://github.com/drone-plugins/drone-git-action

The documentation seems to be broken on this repo as the ** [the docs]** link is redirecting to plugins page where this plugin is not published anymore, hence not able to use it.

Additionally have gone through the link: Clone by SSH not HTTP / GIT Server port override

which mentions disabling the current clone step and making a new step for clone. Any suggestions?

Thanks,
Gaurav

I’m not familiar with the git action plugin … maybe it was a prototype someone was working on? @tboerger can you provide some more details? If no plugin exists you might consider creating your own.

Otherwise as you mentioned you can just disable the default clone step and use your own git clone commands, as described here:
https://docs.drone.io/pipeline/docker/syntax/cloning/

Yeah looks like I forgot to submit some documentation for this plugin. I’m actively using this plugin, but mostly for http cloning. It should work totally fine for ssh cloning and pushing. It could work like this:

kind: pipeline
type: docker
name: custom-clone

platform:
  os: linux
  arch: amd64

clone:
  disable: true

steps:
  - name: clone
    image: plugins/git-action:1
    settings:
      actions:
        - clone
      remote: [email protected]:my-organization/my-repo.git
      branch: master
      path: /drone/src
      ssh_key:
        form_secret: secret-with-private-ssh-key

  // your steps

  - name: commit
    image: plugins/git-action:1
    settings:
      actions:
        - commit
        - push
      message: 'Automated update of foo [skip ci]'
      branch: master
      author_email: [email protected]
      author_name: Drone
      ssh_key:
        form_secret: secret-with-private-ssh-key
    when:
      ref:
        exclude:
          - refs/pull/**

Maybe this example is not directly working, I have written most of that without testing it out, but you can see this plugin in action in repos like https://github.com/owncloud/ocis-hello/blob/master/.drone.star#L473-L560 which clones the repo from master branch, generates a changelog and commits the changelog to the master branch.

2 Likes