in services/ui_backend_service/plugins/plugin.py [0:0]
def _get_credentials(_auth):
if not _auth:
return None
_agent = _auth.get("agent", False)
_public_key = _auth.get("public_key", None)
_private_key = _auth.get("private_key", None)
_username = _auth.get("user", None)
_passphrase = _auth.get("pass", None)
if _agent:
credentials = pygit2.KeypairFromAgent(_username or "git")
elif _public_key and _private_key:
if os.path.exists(_public_key) and os.path.exists(_private_key):
credentials = pygit2.Keypair(_username or "git", _public_key, _private_key, _passphrase or "")
else:
credentials = pygit2.KeypairFromMemory(_username or "git", _public_key, _private_key, _passphrase or "")
elif _username and _passphrase:
credentials = pygit2.UserPass(_username, _passphrase)
elif _username:
credentials = pygit2.Username(_username)
else:
credentials = None
return credentials