简体   繁体   中英

How to read the file data from GIT Repo. without cloning it in local using JGIT API

I tried to find a way to fetch particular file data from GIT Repo. without cloning that file in local using JGit API but didn't found anything related to this. Now, I doubt is there any built in function available in JGit API to allow remote server viewing?

Please can anyone guide me on this?

Edit-1: My GIT repo. is hosted on BitBucket.

JGit is just a wrapper for automating Git specific tasks. If its not available in Git then it shouldn't be available in JGit either. File download is not a Git specific feature, its more like a Git Repository Provider specific feature; for example, Bitbucket and GitHub provides this feature.

Since your repository is hosted on Bitbucket then you should look into their File Download Rest API . You should try to make a custom wrapper for automating this cURL request:

curl -s -L https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/downloads/{file-name}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM