diff --git a/app/models/user.rb b/app/models/user.rb
index b54ce14f0bfbd681402c2c78ee273e0ea545b278..b9bb4a9e3f7e98ec24e216f28bb8c0463cb45f5c 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -512,7 +512,7 @@ class User < ActiveRecord::Base
   end
 
   def require_ssh_key?
-    keys.count == 0
+    keys.count == 0 && Gitlab::ProtocolAccess.allowed?('ssh')
   end
 
   def require_password?
diff --git a/changelogs/unreleased/24921-hide-prompt-to-add-ssh-key-if-ssh-protocol-is-disabled.yml b/changelogs/unreleased/24921-hide-prompt-to-add-ssh-key-if-ssh-protocol-is-disabled.yml
new file mode 100644
index 0000000000000000000000000000000000000000..4d4019e770eb77cc057960f901a767f10e6c3f24
--- /dev/null
+++ b/changelogs/unreleased/24921-hide-prompt-to-add-ssh-key-if-ssh-protocol-is-disabled.yml
@@ -0,0 +1,4 @@
+---
+title: Don't display prompt to add SSH keys if SSH protocol is disabled
+merge_request: 7840
+author: Andrew Smith (EspadaV8)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 14c891994d0d221c56e4bf2daeffc3949b5adcfa..2244803f90c263b39cb338e67437d460c70c8ac4 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -575,6 +575,23 @@ describe User, models: true do
         end
       end
     end
+
+    describe '#require_ssh_key?' do
+      protocol_and_expectation = {
+        'http' => false,
+        'ssh' => true,
+        '' => true,
+      }
+
+      protocol_and_expectation.each do |protocol, expected|
+        it "has correct require_ssh_key?" do
+          stub_application_setting(enabled_git_access_protocol: protocol)
+          user = build(:user)
+
+          expect(user.require_ssh_key?).to eq(expected)
+        end
+      end
+    end
   end
 
   describe '.find_by_any_email' do