Viewing file from Git using JGIT remotely without creating local repo

一个人想着一个人 提交于 2019-12-11 17:35:07

问题


I m writing a web application where it accepts the git URL and file to read and then displays the file on the webpage. I m using JGit for this. I see that JGit needs a local repository to clone before viewing the file. Since this is server, I do not have access to local files. So, is there anyway I can access the git remotely and view the file from there?

Thanks


回答1:


It's not just JGit that needs a local repository, Git itself requires a local repository. Centralized version control systems like CVS and SVN had remote server viewing built-in, but decentralized systems (such as Git and Mercurial) typically do not.

If you want to browse a Git server, you have to make a local clone, but you could do this in the background for the user.

You might also be interested in the GitHub API, which lets you do what you want, but only for repositories hosted by GitHub.



来源:https://stackoverflow.com/questions/19414568/viewing-file-from-git-using-jgit-remotely-without-creating-local-repo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!