I have already seen:
- How to run GIT commands on remote repository - "SSH into the server" or "
git fetch
;gitk --all
" - Run git commands on remote working tree (GIT_WORK_TREE=/path) - the answer is about
git push --tags
- How to "git show" on a remote repo? - "Use git fetch to get the remote history, then snatch the file from the local object store."
- How to run git command remotely? - "
ssh username@host "cd my/repo/path && git show"
" - How can I manually run the hook post-receive on git? "A hook is an executable shell script. You can execute it from the command line if you need to run it by hand, although constructing the expected stdin inuput is somewhat tedious if your repo has more than one head (that is, you use branches)."
- Detecting changes to remote branch - "Don't monitor files in the inner workings of git manually. Use git to check things for you. In this case
git rev-parse --verify origin/master
will show you the SHA of your local copy of origin/master, andgit ls-remote origin master
to get the SHA from the remote." - Commit history on remote repository - "
git log remotename/branchname
- You can't connect directly to the server to check the log there, what you do is download the state of the server withgit fetch
and then locally see the log of the remote branches."
Judging by this, for what I want to do, I have to login via ssh
and run a script on the remote server; but I was hoping for a more git-integrated solution, so let me explain what I want to do.
I have a remote repo, which is git-svn; then I have a local git-only repo which is a clone of the remote. So, the local has a reference to the remote URL in remote.origin.url
(seen via git config --list
).
What I want to do, is run the equivalent of git svn log
(maybe with some post-processing) on the remote, but with the call initiated from the local machine/repo - and get the results, again on the local machine/repo. Of course, git-svn
may not even be installed on the local machine, which means only the remote would be able to understand such a command.
I'd be ready to code a hook for the remote repo - but as far as I can see, hooks can run only at specified events (i.e. pull
, update
...) - you cannot really call them arbitrarily: I remember, once I was developing a post-update
script; and to debug it, I had to set it to return an error always, and then I'd "push" a "fake" commit, which would have run the script, and upon the reception of the error, roll-back the repo -- of course, this is not how I imagine the remote script should run.
Another thing that might be possible is to code an alias for the local repo, which then calls SSH in respect to the remote.origin.url
- maybe that would make the running of git svn log
remotely a bit easier?
In the end, this is my question - what options do I have to run a relatively custom git
command (like git svn log
, or a git
alias defined remotely) on a remote repo, by utilizing to greatest extent possible the data already available in the local repo (that is, I want to avoid writing a bash
script, with repeated hardcoded paths/URLs, that will call ssh
and do whatever necessary on the remote) -- possibly, in a similar manner that a remote post-update
git
hook returns its stdout to the local caller, prefixed by "remote: "?