git lfs lock fails if deploy key is used

Summary

Deploy keys with write access should be able to use git lfs lock and git lfs unlock. Using a deploy to create or remove LFS locks should not trigger a server error.

Steps to reproduce

  1. Add key as deploy key to a repository, mark the checkbox "write access allowed" as checked.
  2. Clone the repository (via SSH, using the uploaded deploy key) and execute touch test && git lfs lock test in the work tree.

What is the current bug behavior?

➜ touch test

➜ git lfs lock test
Lock failed: Server error: https://gitlab.com/user/project.git/info/lfs/locks

➜ git lfs unlock -f test
Lock failed: Server error: https://gitlab.com/user/project.git/info/lfs/locks

What is the expected correct behavior?

➜ touch test

➜ git lfs lock test
Locked test

➜ git lfs unlock -f test
Unlocked test

Environment

I can reproduce this on both GitLab.com and our self-hosted GitLab instance (11.9.4).

Assignee Loading
Time tracking Loading