How to run Git commands on remote repository

僤鯓⒐⒋嵵緔 提交于 2019-12-23 17:32:54

问题


I am trying to code an simple PHP application which will retrieve some information from the remote Git repositories with terminal commands. I do not want to create a local working copy or repository. I only want to read information from remote repositories (browse tree, commit history, file diffs, download file), so it will be a read only connection.

What I need to do is to run a series of simple commands like those in SVN: log, ls, diff, cat,..

I have allready done that for SVN and it was easy. Usually commands were similar to this format:

svn --user myusername --pass mypassword --non-interactive command -r revisionNumber urlToRemoteRepository

My question is how to get similar information from Git repositories with terminal commands only?


回答1:


I would SSH into the server using PuTTY (windows) or the ssh command (Mac/Linux) and run them from the command line there.




回答2:


This is not the preferred workflow in git.

git fetch

Then use

gitk --all

or

git log --all --decorate --graph # optionally --oneline if there's lots there

to investigate what you got. Learn tree-ish syntax, branch specifications etc.

hope this helps



来源:https://stackoverflow.com/questions/4269611/how-to-run-git-commands-on-remote-repository

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