Why are the various git commands only available locally?

There is a very limited number of commands that you can run again on the remote repository using the standard clients.
Most of the remote commands are provided git-ls-remote

. Is this limitation only for git client or git server?

I would like to write a client that provides most of the commands that can be run locally to run on a remote repository.

A good example for this would be getting logs (i.e. git log

), hence the reason for the question. Current practice is to use a proprietary API developed by any service that hosts a git repostory (github, gitlab, gerrit, bitbucket, stash, etc.), so I think a client developed using the standard git protocol would parse this question.

+3


source to share


1 answer


I think a client developed using the standard git protocol will address this issue.

This will revert the decentralized git model (where every operation will be local and fast) to the centralized one (where you need to access the server to perform the operation.

Most of the commands (logs, diff, commit, ...) make sense when you have a complete repo.

If the git server provides data, I want to develop a client that will take these APIs out of business.

No "git server", only listeners (httpd or sshd) which are then called git-receive-pack

and git-upload-pack

(in the case of smart protocol ).

http://stefan.saasen.me/articles/git-clone-in-haskell-from-the-bottom-up/images/pack-client-server.png

(From " Redoing" git clone "in Haskell from the bottom up ")

This is why the API is being developed on top of these listeners to expose these commands (local to repositories managed by the hosting server).




One option that I am aware of is local gitolite site commands .
Gitolite is an authentication layer (called an https or ssh listener and verifying the user's right to access the repo). <w> It can delegate some commands to be executed "locally" on the server:

The main purpose of the gitolite is to prevent the formation of a shell. But there are commands that you often need to run on the server (i.e. cannot be done by pushing something to the repo).

To enable this, gitolite allows an administrator to set up scripts in a special directory that users can then execute. Gitolite comes with a set of working scripts that your administrator can install or use as a starting point for their own if they wish.

Think of these commands as equivalent to the COMMAND_DIR commands in man git -shell.




Possible extension: see " GitTorrent Declaration: Decentralized GitHub "

This is an example of getting something other than package files from the git server.

Using a different protocol can make the git clone return something other than the full repo:

git clone gittorrent://github.com/cjb/recursers

      

Git actually has an extensible mechanism for creating network protocols. The way it works is that my clone git line turns into "run command and give it url as argument". git-remote-gittorrent

+5


source







All Articles