Pushing a git tag to Github in a plugin

Hey, thanks for Drone & thanks for your answers in Discourse! From searching these forums I’ve found that the following works for pushing a git tag:

    image: docker:git
    - git tag whatever
    - git push origin --tags

where the commands are done explicitly in the Drone pipeline. However, when attempting to do the same thing from inside a plugin, I get an error (presumably auth related)

    image: gempesaw/drone-git-tag
    plugin: true

which gives an error like

fatal: could not read Username for 'https://github.com': No such device or address

Is this expected behavior? Is there a way for plugins to push to github ?

The gempesaw/drone-git-tag image just runs the same commands as in the explicit version. Other info … we’re running drone 0.8.1 in kubernetes. The repo settings in Drone are ‘Trusted’ and ‘Private’. The repo in Github is also private.

Thanks again, Brad! Introducing fast & useful CI/CD to my company has been one of my long term personal goals, and Drone has been a huge part of that effort for us. :slight_smile:

related topics:

Is this expected behavior? Is there a way for plugins to push to github ?

yes, drone does some magic under the covers where it automatically creates a .netrc file with your git credentials for command steps. If you are creating a plugin, you need to handle creation of this file. Here are bash and Go examples that demonstrate:

also there is an existing plugin you might be able to use: https://github.com/appleboy/drone-git-push/blob/master/DOCS.md

1 Like

oh, great, that’s quite straightforward. Thanks!