MCPcopy Create free account
hub / github.com/gogs/gogs / addDeployKey

Function addDeployKey

internal/database/ssh_key.go:628–641  ·  view source on GitHub ↗

addDeployKey adds new key-repo relation.

(e *xorm.Session, keyID, repoID int64, name, fingerprint string)

Source from the content-addressed store, hash-verified

626
627// addDeployKey adds new key-repo relation.
628func addDeployKey(e *xorm.Session, keyID, repoID int64, name, fingerprint string) (*DeployKey, error) {
629 if err := checkDeployKey(e, keyID, repoID, name); err != nil {
630 return nil, err
631 }
632
633 key := &DeployKey{
634 KeyID: keyID,
635 RepoID: repoID,
636 Name: name,
637 Fingerprint: fingerprint,
638 }
639 _, err := e.Insert(key)
640 return key, err
641}
642
643// HasDeployKey returns true if public key is a deploy key of given repository.
644func HasDeployKey(keyID, repoID int64) bool {

Callers 1

AddDeployKeyFunction · 0.85

Calls 2

InsertMethod · 0.80
checkDeployKeyFunction · 0.70

Tested by

no test coverage detected