title: Why git commit command is not working by using java using the jproc library?
body: <p>I am trying to write a code to commit with git but it is working sometimes and not working the other time.
  Here is the code for it:</p>
  <pre><code>ProcResult result = new ProcBuilder(&quot;git&quot;)
                  .withArg(&quot;init&quot;)
                  .withWorkingDirectory(new File(dir))
                  .run();
  
          result = new ProcBuilder(&quot;git&quot;)
                  .withArgs(&quot;add&quot;,&quot;.&quot;)
                  .run();
          result = new ProcBuilder(&quot;git&quot;)
                  .withArgs(&quot;commit&quot;,&quot;-m&quot;).withArg(&quot;1st commit&quot;)
                  .run();
          System.out.println(&quot;Successfully commited&quot;);
  </code></pre>
  <p>I tried something like the given code below but it still doesn't work:</p>
  <pre><code>result = new ProcBuilder(&quot;git&quot;)
              .withArgs(&quot;commit&quot;,&quot;-m&quot;).withArg(&quot;&quot;+(char)34+&quot;1st commit&quot;+(char)34+&quot;&quot;)
              .run();
  </code></pre>
  <p>It throws the following exception:</p>
  <pre><code>Exception in thread &quot;main&quot; org.buildobjects.process.ExternalProcessFailureException: External process 'git commit -m '1st commit'' returned 1 after 126ms
  
      at org.buildobjects.process.Proc.&lt;init&gt;(Proc.java:126)
      at org.buildobjects.process.ProcBuilder.run(ProcBuilder.java:205)
      at ProjectInitializerAutomation.ProjectInitializerAutomation.Local.command(Local.java:90)
      at ProjectInitializerAutomation.ProjectInitializerAutomation.Local.createFolder(Local.java:58)
      at ProjectInitializerAutomation.ProjectInitializerAutomation.Local.create(Local.java:39)
      at ProjectInitializerAutomation.ProjectInitializerAutomation.Driver.main(Driver.java:21)
  </code></pre>