簡體   English   中英

如何使用 GitLab4j 從 GitLab 獲取文件

[英]How Fetch file From GitLab using by GitLab4j

如何從 gitLab 獲取文件,使用 GitLab4j 我的代碼查看:

`

    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");

` 瀏覽器中的鏈接有效,之后:我有錯誤。 線程“主”org.gitlab4j.api:GitLabApiException: 404 File Not Found 中的異常

或:線程“主”org.gitlab4j.api.GitLabApiException 中的異常:404 Commit Not Found

如果你有興趣回答我的問題,那么也是

`

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);

`享受

謝謝我!)

還有一件事,如果你得到“SSLHandhakeExeption”,那么使用

gitLabApi.setIgnoreCertificateErrors(true);

先聲明gitlabApi,在gitLabApi.setIgnoreCertificateErrors(true)之后; ,畢竟,RepositoryFile

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM