AuthorizedKeysCommand /usr/libexec/phabricator-ssh-hook.sh git failed

1st time using a ubuntu 18.04 distro.

attempt to debug
usr@precision-7510 $ ssh git@138.197.x.x conduit conduit.ping -i ~/.ssh/id_rsa

git@138.197.x.x: Permission denied (publickey).

if I tail /var/log/auth.log

Sep 16 04:31:02 phabricator sshd[2780]: AuthorizedKeysCommand /usr/libexec/phabricator-ssh-hook.sh git failed, status 255

Sep 16 04:31:02 phabricator sshd[2780]: Connection closed by authenticating user git 104.34.x.x port 20130 [preauth]

added this to machine

adduser --disabled-password phabricator
adduser --disabled-password git
./bin/config set phd.user phabricator
./bin/config set diffusion.ssh-user git
sudo usermod -p NP git
sudo usermod -p NP phabricator

line in my /etc/sudoers

git ALL=(phabricator) SETENV: NOPASSWD: /bin/ls, /usr/bin/git, /usr/bin/git-upload-pack, /usr/bin/git-receive-pack

Figured out why it failed

[2018-09-15 21:45:59] EXCEPTION: (Exception) Define 'phabricator.base-uri' in your configuration to continue. at [<phabricator>/src/infrastructure/env/PhabricatorEnv.php:504]
arcanist(head=master, ref.master=2650e8627a20), phabricator(head=master, ref.master=0167f357b723), phutil(head=master, ref.master=3215e4e291ed)
  #0 PhabricatorEnv::getAnyBaseURI() called at [<phabricator>/src/infrastructure/env/PhabricatorEnv.php:464]
  #1 PhabricatorEnv::getCDNURI(string) called at [<phabricator>/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php:101]
  #2 PhabricatorUserProfileImageCacheType::getCacheVersion(PhabricatorUser) called at [<phabricator>/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php:96]
  #3 PhabricatorUserProfileImageCacheType::isRawCacheDataValid(PhabricatorUser, string, string) called at [<phabricator>/src/applications/people/query/PhabricatorPeopleQuery.php:580]
  #4 PhabricatorPeopleQuery::fillUserCaches(array) called at [<phabricator>/src/applications/people/query/PhabricatorPeopleQuery.php:212]
  #5 PhabricatorPeopleQuery::didFilterPage(array) called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:273]
  #6 PhabricatorPolicyAwareQuery::execute() called at [<phabricator>/src/applications/phid/type/PhabricatorPHIDType.php:91]
  #7 PhabricatorPHIDType::loadObjects(PhabricatorObjectQuery, array) called at [<phabricator>/src/applications/phid/query/PhabricatorObjectQuery.php:153]
  #8 PhabricatorObjectQuery::loadObjectsByPHID(array, array) called at [<phabricator>/src/applications/phid/query/PhabricatorObjectQuery.php:73]
  #9 PhabricatorObjectQuery::loadPage() called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:236]
  #10 PhabricatorPolicyAwareQuery::execute() called at [<phabricator>/src/applications/auth/query/PhabricatorAuthSSHKeyQuery.php:61]
  #11 PhabricatorAuthSSHKeyQuery::willFilterPage(array) called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:247]
  #12 PhabricatorPolicyAwareQuery::execute() called at [<phabricator>/scripts/ssh/ssh-auth.php:29]
debug2: key not found

I had to shut off the sshd listener and manually run: /usr/sbin/sshd -d -d -d -f /etc/ssh/sshd_config.phabricator in order to figure out I had to run ./bin/config set phabricator.base-uri 'http://138.197.x.x/'

I didn’t know what my base-uri would be because I’m not in control of the DNS, so you really should have your ip & subdomain pointed straight away before you configure, otherwise you’ll need to set the ip address. I think another error should kick out if it realizes you’re doing repo hosting to let you know this might happen.