Hot questions for Using Ubuntu in git



It's maybe related to a problem of ca-certificates, try to run this command:

update-ca-certificates -f

According to the man page:

update-ca-certificates is a program that updates the directory /etc/ssl/certs to 
hold SSL certificates and generatescertificates.crt, a concatenated single-file 
list of certificates.


Here is my .gitlab-ci.yml script.

  - uname -a
  - apt-get install default-jre default-jdk openjdk-7-jre openjdk-7-jdk
  - java -version
  - export MODE="service"
  - export PID_FOLDER="/var/run/gitlab-runner-test"

    - chmod +x gradlew
    - ./gradlew assembleDebug

I am trying to run the script on page to compile a android project. I checked with some alterations to my script that there is no java installed on the ci linux Linux runner-8a2f473d-project-881036-concurrent-0 4.5.0-coreos-r1 #2 SMP Thu May 5 07:27:26 UTC 2016 x86_64 GNU/Linux.

I tried installing java, just like a sample which was shown for ruby, but it does not work, and gives an Unable to locate package error.

I am not sure what should be the package as it seems like a ubuntu system, but the command which works on my ubuntu does not work here.

This is not a local installation.


I believe you should be able to use the image feature described here. I found success with the anapsix/alpine-java:jdk8 Docker image.

I am using my own Docker gitlab-runner with a custom Docker image as I need Maven with Oracle java. I'm not 100% on if the shared runner on allows you to use your own image.

My Dockerfile for that (which I upload to Gitlab and use their new Docker container register feature)

FROM anapsix/alpine-java:jdk8


RUN apk update && apk upgrade && apk add curl wget bash tar rsync openssh-client

RUN mkdir -p /usr/share/maven \
  && curl -fsSL$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \
    | tar -xzC /usr/share/maven --strip-components=1 \
  && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn \
  && rm -rf /tmp/* /var/cache/apk/*;

ENV MAVEN_HOME /usr/share/maven

CMD ["bash"]


I keep getting an error that I shouldn't be getting and I am no regex expert but it should be so simple. I looked over it so many times and can't figure out why it isn't working. I have also searched a bunch for something similar but I can't find anyone that has the same problem.

This is the error I'm getting:

Exception in thread "main" java.lang.IllegalStateException: No match found
    at DailyData.importUsers(
    at DailyData.main(

Here is my code, through debugging I found its the last line that gives the error:

Pattern memberSincePattern = Pattern.compile("\\W*(\\d+):(\\d+):(\\d+)\\W*(\\d+)/(\\d+)/(\\d+)");
Matcher memberSinceMatcher = memberSincePattern.matcher("12:12:12 12/12/2012");
String msGroupOne =;

I am using eclipse on Ubuntu 14.04 LTS. I have imported the proper libraries and have tried \d{1,2} for the digits as well as getting rid of the leading \W*. I want it to be able to grab either 1 or two digits for each group. I get no syntax errors or warnings on this either.


As the exception indicates, you need to find a match to your regex before looking for a matched group.

For example, you could use Matcher#matches, as follows:

Pattern memberSincePattern = Pattern.compile("\\W*(\\d+):(\\d+):(\\d+)\\W*(\\d+)/(\\d+)/(\\d+)");
Matcher memberSinceMatcher = memberSincePattern.matcher("12:12:12 12/12/2012");

if(memberSinceMatcher.matches()) {
    String msGroupOne =;

Here's the javadoc entry for Matcher#matches.

As a side note, I'd like to point out that if you want to match only a sub-sequence of your original String, at least one time, you should use Matcher#find instead of Matcher#matches. Possibly in a while loop :)


The following commands works directly:

rsync -rtuc --delete-after --exclude '.git*' --filter 'protect .git/**/*' ~/some/source/ ~/some/destination/

But when run via java:

private Boolean syncFiles() {
            // Success flag default to true
            Boolean success = true;
            // Attempt sync repo
            try {
                ProcessBuilder runtimeProcessBuilder = new ProcessBuilder().inheritIO().command(new String[]{
                    "rsync", "-rtuc","--delete-after", "--exclude", "'.git*'", "--filter", "'protect .git/**/*'", "~/some/source/", "~/some/destination/"
                // Wait until process terminates
                int output = runtimeProcessBuilder.start().waitFor();
                // Determine if successful
                if (output == 0) {
                    System.out.println("Backup of " + getSource() + " to " + getDestination()
                            + " was successful");
                } else {
                    System.out.println("Error: rsync returned error code: " + output);
                    success = false;
            } catch (Exception ex) {
                success = false;
                Logger.getLogger(Rsync.class.getName()).log(Level.SEVERE, null, ex);
            return success;

I get the error:

Unknown filter rule: `'protect .git/**/*'' Error: rsync returned error code: 1 rsync error: syntax or usage error (code 1) at exclude.c(902) [client=3.1.2]


The shell handles quoting before passing the parameters to the command.

The comes into play with this part of your command line:

 'protect .git/**/*'

The shell interprets this as the single parameter:

 protect .git/**/*

If the single quotes had not been there in the first place, the shell would have:

  • interpreted it as two parameters (because of the space)
  • expanded glob characters like "*"

The solution is to pass:

"protect .git/**/"

as one of your Java parameters, rather than "'protect .git/**/*'".

You may have similar problems with ~, which the shell will expand to your home directory.


I have a Spring Boot project which passes all it's tests under the mvn clean install command in Windows 10. The same exact code base, against the same database, has some test case failures when executing mvn clean install in Ubuntu 16.04. I traced the problem to a directory not being created by the code inside a failing test case using the mkdirs() function. I don't know why, I mean, I own the project so I wouldn't think it's a permissions issue. I cloned the project in Ubuntu from the remote repository using Intellij IDEA's built in Git functionality. Many of the other test cases (hundreds of them) are passing but a few fail and they are all related to this mkdirs() issue. Just to reiterate, the problem only exists in Ubuntu 16.04, not in Windows 10 where all tests pass. If more information is needed please let me know I'll provide.

Is there any way to resolve it without altering the code?


I found that the issue was a root directory setting being set in a configuration file of the code base. While that root directory would be openly accessible on a Windows platform, on Ubuntu it was restricted. Changing the setting in the configuration file to point to a base directory where I know I had write permission solved the issue.