### Please describe the problem.
git-annex-shell -c configlist /home/annex/test2.git, when ran via sudo (login shell or otherwise), works fine. When executed equivalently over SSH, this error is given:
[[!format sh """
git-annex-shell: failed to read git config of git repository in unknown on /home/annex/test2.git; perhaps this repository is not set up correctly or has moved
"""]]

(note: I am using a workaround necessary due to another bug with git-annex-shell, I will also post that bug)

### What steps will reproduce the problem?
See the transcript.

### What version of git-annex are you using? On what operating system?
6.20180529 on NixOS.

### Please provide any additional information below.

[[!format sh """
# If you can, paste a complete transcript of the problem occurring here.
# If the problem is with the git-annex assistant, paste in .git/annex/daemon.log

[leo60228@nixos:~/test]$ ssh annex@localhost 'git-annex-shell -c configlist /home/annex/test2.git'
git-annex-shell: failed to read git config of git repository in unknown on /home/annex/test2.git; perhaps this repository is not set up correctly or has moved

[leo60228@nixos:~/test]$ sudo -i -u annex git-annex-shell -c configlist /home/annex/test2.git
annex.uuid=425c1e27-97df-4c14-8bf3-d7473e78dbfd
core.gcrypt-id=

# End of transcript or log.
"""]]

### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Yes.

[[done]]
