Yours, Etc.: Origins and Uses of 8 Sign-Offs
c.1300, agast, "terrified," past participle of Middle English agasten "to frighten" (c.1200), from a- intensive prefix + Old English gæstan "to terrify," from gæst "spirit, ghost" (see ghost). The -gh- spelling appeared early 15c. in Scottish and is possibly a Flemish influence, or after ghost, etc. It became general after 1700.