feibabm
feibabm

Reputation: 221

Using Spring Cloud Config java.lang.IllegalStateException: No .git

my application.yml:

    server:
  port: 8888

eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

spring:
  cloud:
    config:
      server:[enter image description here][1]
        git:
          searchPaths: cloud-config-repo
          uri: file:///E:/idea/spring-cloud-microservice-example-master/config-microservice/src/main/resources/configPath

when using the url:http://localhost:8888/movie/default,i got the misstake:java.lang.IllegalStateException: No .git at file:///E:/idea/spring-cloud-microservice-example-master/config-microservice/src/main/resources/configPath

Upvotes: 5

Views: 5716

Answers (3)

Hasnaa Ibraheem
Hasnaa Ibraheem

Reputation: 1140

In my case I faced this issue with Intellij; it failed to refresh my gradle projects giving this error: java.lang.IllegalStateException: error invoking git command
I went to Preferences -> Git and I found that this field is empty: "Path to Git executable". Having that field empty means that the default value is usually: "/usr/bin/git" while invoking which git on the terminal revealed that the right path was: "/usr/local/bin/git"
Applying that path didn't fix the issue right away; I had to restart intellij to completely resolve that issue.

Upvotes: 0

Fazal Haroon
Fazal Haroon

Reputation: 1193

I have this issue in my project, i use spring cloud config server

java.lang.IllegalStateException: No .git at

to resolve this issue, i configure my spring cloud config server with A to Z, and each and everything fine but facing this problem because I didn't add the .git file in my git-localconfig-repo, I just open the CMD as shown in the screenshot enter image description here

After running the above git commands then change properties file of config server

/spring-cloud-config-server/pom.xml

spring.application.name=spring-cloud-config-server
server.port=8888
spring.cloud.config.server.git.uri=file:/D:/Learning/c7/microservices/spring-microservices/02.Microservice-2x-Spring-boot/spring-cloud-config-server/git-localconfig-repo

Example: file:/D:/project-folder-name/configPath

And it also works For Windows I used it like this

spring.application.name=spring-cloud-config-server
server.port=8888

spring.cloud.config.server.git.uri=D:\\\\Learning\\\\c7\\\\microservices\\\\spring-microservices\\\\02.Microservice-2x-Spring-boot\\\\spring-cloud-config-server\\\\git-localconfig-repo

Try like this, I hope it will work

Upvotes: 2

feibabm
feibabm

Reputation: 221

After some days, i found you should create git repository in local machine for this directory: uri: file:///E:/idea/spring-cloud-microservice-example-master/config-microservice/src/main/resources/configPath

Upvotes: 7

Related Questions