3

I'm trying to release using the gradle release plugin but whenever the plugin is using GIT, it's not passing my username and password:

I 'm invoking it as:

I'm using:

C:\GradleReleaseTest>gradle --version

------------------------------------------------------------
Gradle 2.11
------------------------------------------------------------

Build time:   2016-02-08 07:59:16 UTC
Build number: none
Revision:     584db1c7c90bdd1de1d1c4c51271c665bfcba978

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_66 (Oracle Corporation 25.66-b18)
OS:           Windows 7 6.1 amd64

My gradle release configuration looks as:

release {
    failOnCommitNeeded = true
    failOnPublishNeeded = true
    failOnSnapshotDependencies = true
    failOnUnversionedFiles = true
    failOnUpdateNeeded = true
    revertOnFail = true
    preCommitText = ''
    preTagCommitMessage = '[Gradle Release Plugin] ${release.releaseVersion} - pre tag commit: '
    tagCommitMessage = '[Gradle Release Plugin] ${release.releaseVersion} - creating tag : '
    newVersionCommitMessage = '[Gradle Release Plugin] ${release.releaseVersion} - new version commit: '
    tagTemplate = '${version}'
    // May decide to add additional custom tasks here
    buildTasks = ['build']
    scmAdapters = [
        net.researchgate.release.GitAdapter
    ]
}

The error I'm getting looks like:

C:\GradleReleaseTest>gradle release -Prelease.releaseVersion=1
.0.0 -Prelease.newVersion=1.0.1-SNAPSHOT -Prelease.username=jvergara -Prelease.p
assword=thePassword
:release
:com.mycompany.gradletest:createScmAdapter
:com.mycompany.gradletest:initScmAdapter
:com.mycompany.gradletest:checkCommitNeeded
:com.mycompany.gradletest:checkUpdateNeeded
Running [git, remote, update] produced an error: [bash: /dev/tty: No such device
 or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.mycompany.com': Invalid ar
gument
error: Could not fetch origin]
:com.mycompany.gradletest:checkUpdateNeeded FAILED
:release FAILED
Release process failed, reverting back any changes made by Release Plugin.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':checkUpdateNeeded'.
> Failed to run [git remote update] - [Fetching origin
][bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://git.mycompany.com': Invalid ar
gument
error: Could not fetch origin
]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

BUILD FAILED

Total time: 5.912 secs
jvergara
  • 101
  • 2
  • 4

1 Answers1

1

I managed to resolve this. The problem has nothing to do with the plugin at all, but rather how git itself work.

You either have to use a global config for the credentials or you have to use local config

See, https://git-scm.com/docs/gitcredentials. I used the local version and it works just fine.

jvergara
  • 101
  • 2
  • 4