'Glide Process 'command 'git'' finished with non-zero exit value 128

I have downloaded Glide from Github and wanted to test the program on Android studio. But once i Clean the project, i have this error

Information:Gradle tasks [clean]
fatal: Not a git repository (or any of the parent directories): .git
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred evaluating settings 'glide-master'.
> Process 'command 'git'' finished with non-zero exit value 128
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Information:BUILD FAILED
Information:Total time: 0.28 secs
Error:fatal: Not a git repository (or any of the parent directories): .git

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/MyComputer/Downloads/glide-master/settings.gradle' line: 1

* What went wrong:
A problem occurred evaluating settings 'glide-master'.
> Process 'command 'git'' finished with non-zero exit value 128

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

Information:1 error
Information:0 warnings
Information:See complete output in console 

what does the error mean? I have build using Gradle.it is because of version problem on Android studio?



Solution 1:[1]

Same error occurred for me also.

In build.gradle previous code like

exec {
        commandLine 'git', 'describe', '--tags'
    }

then I added 'cmd' before 'git'

and that error gone.

below is code after adding the code

exec {
        commandLine 'cmd', 'git', 'describe', '--tags'

    }

Solution 2:[2]

exec {
    commandLine "git", "submodule", "update", "--init", "--recursive"
}

Then I added cmd before git.

and that error gone.

exec {
    commandLine "cmd","git", "submodule", "update", "--init", "--recursive"
}

Solution 3:[3]

This happen if git not configured properly with the Android Studio project.
And nobody seems experienced this before. Because I google thousand times and solutions not work.

What is just work for me:

  • Solution for Gradle Build Android Studio Project
  • Clone the project from git. Or Upload your project to git and clone Fresh in empty folder of your PC. (This is for configure git properly, other way did not work properly to my project)
  • Delete if any .idea folder exists.
  • Open as existing Android Studio project.
  • Let it roll. If it require any dependency, continue with that.

Solution 4:[4]

new ByteArrayOutputStream().withStream { os ->
    def result = exec {
        executable = 'git'
        args = ['log', '-1', '--pretty=format:%ct']
        standardOutput = os
    }

    return os.toString() + "000"
}

Change to the following code

new ByteArrayOutputStream().withStream { os ->
    def result = exec {
        executable = 'cmd'
        args = ['log', '-1', '--pretty=format:%ct']
        standardOutput = os
    }

    return os.toString() + "000"
}

Solution 5:[5]

Take a look at this, it is the only answer that worked for me on OSX

https://stackoverflow.com/a/27100821/2587350

Solution 6:[6]

In MAC OS redownload command-line tools and make sure that it is assigned to path.

A easy fix is to install Xcode and run a demo project. This sets up the dependencies properly.

Solution 7:[7]

the process is executing in the gradle's own directory (~/.gradle/x.y.z)

use cmd.execute([], project.projectDir) with arguments

Solution 8:[8]

In my case when I checked git status I got the following output:

fatal: unsafe repository ('/home/Documents/Examples/Example.App' is owned by someone else)
To add an exception for this directory, call:

git config --global --add safe.directory /home/Documents/Examples/Example.App

which I did and it worked :) (the path is just an example, but you will get your full path of the project)

Solution 9:[9]

Looking at your screenshot it looks like you've not configured cors correctly on your backend. Either put * as value so requests from anywhere are allowed, or put the URL of your frontend application instead of the URL of your backend API. (https://ural-shop.herokuapp.com/ is what you've configured and it should be the URL of your frontend application)

Let me know if it worked.

Solution 10:[10]

I had the same issue with the same tech stack. And this took me 3 days to find out this was all CORS issue. But you need to include your Heroku server in your CORS whitelist.

According to the official docs:

Since Socket.IO v3, you need to explicitly enable Cross-Origin Resource Sharing (CORS).

client-site

So, everything you have to do is to specify the correct URL according to the environment. If you want to set only with the production URL, it will work both in the local or prod environment.

Mine is dynamic like this:

const IS_PROD = process.env.NODE_ENV === "production";
const URL = IS_PROD ? "yoursite.herokuapp.com" : "http://localhost:5000";
const socket = io(URL);

server-side

...
const io = socket(server, {
        cors: {
            origin: ["http://localhost:3000", "yoursite.herokuapp.com"],
        },
    });

Very important: You also have to make sure that you development is in sync with your production side. Otherwise, you will test it and see the same error, but only because you didn't update your production, too. Yep, this kind of silly mistakes can happen...

Hope that helps someone in the same situation. This solved my issue.