2

How to fetch file from gitLab, using by GitLab4j my code look:

`

 Object obj = 19851511; GitLabApi gitLabApi = new GitLabApi("https://gitlab.com/", "TOKEN"); RepositoryFile file = gitLabApi.getRepositoryFileApi().getFile(obj , "https://gitlab.com/kashirin.kostiantyn/fackinproj/-/blob/5cfd2c42ece5532aa174ec8b90700a656651ff92/test.rtf" , "master"); 

` Link in browser is work! After, I have error: Exception in thread "main" org.gitlab4j.api.GitLabApiException: 404 File Not Found

or: Exception in thread "main" org.gitlab4j.api.GitLabApiException: 404 Commit Not Found

1 Answer 1

2

if you interest answer in my question, so is

`

Object obj = 19851511; GitLabApi gitLabApi = new GitLabApi("https://gitlab.com/", "TOKEN"); RepositoryFile file = gitLabApi.getRepositoryFileApi().getFile(obj,"src/.gitkeep" , "master"); System.out.println("TExt decodet \n"+file.getDecodedContentAsString()); System.out.println("This all info from FILE \n"+file); 

` enjoy

Thank me!)

and one more thing! If you get "SSLHandhakeExeption", so use

gitLabApi.setIgnoreCertificateErrors(true);

First declare gitlabApi, after gitLabApi.setIgnoreCertificateErrors(true); ,and after all, RepositoryFile

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.