Search code examples
androidkotlingradlegradle-kotlin-dsl

Unable to make a pull in gradle file


i´m trying to make a task in Gradle for my Android project ( using Kotlin DSL ) where I need to do an automatic pull for my "develop" branch.

This are the commnand I want to run :

git pull origin develop:develop

In the terminal this works just fine.

I`m using "commandLine" with "exec" in my gradle file and I´m having this error message:

code:

tasks.register<ReleaseTask>("makePull") {
    exec { commandLine("git", "pull", "origin develop:develop") }
}

error message:

ssh: Could not resolve hostname origin develop: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

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

FAILURE: Build failed with an exception.

I don´t have any issue if I try this commands in the terminal, do you know what i´m doing wrong ?


Solution

  • You haven't separated the origin and the develop:develop arguments in the gradle version. Use this instead:

    commandLine("git", "pull", "origin", "develop:develop")