5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 09:51:42 +00:00

feat: poder pushear a cualquier remoto
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
f 2023-09-22 13:20:20 -03:00
parent c176a8a4b4
commit aeaf72c270
No known key found for this signature in database

View file

@ -158,22 +158,29 @@ class Site
# Pushea cambios al repositorio remoto # Pushea cambios al repositorio remoto
# #
# @param :remote [Rugged::Remote]
# @return [Boolean, nil] # @return [Boolean, nil]
def push def push(remote = origin)
origin.push(rugged.head.canonical_name, credentials: credentials) remote.push(rugged.head.canonical_name, credentials: credentials_for(remote))
git_sh("git", "lfs", "push", "origin", default_branch) git_sh('git', 'lfs', 'push', remote.name, default_branch)
end end
private private
# @deprecated
def credentials
@credentials ||= credentials_for(origin)
end
# Si Sutty tiene una llave privada de tipo ED25519, devuelve las # Si Sutty tiene una llave privada de tipo ED25519, devuelve las
# credenciales necesarias para trabajar con repositorios remotos. # credenciales necesarias para trabajar con repositorios remotos.
# #
# @param :remote [Rugged::Remote]
# @return [Nil, Rugged::Credentials::SshKey] # @return [Nil, Rugged::Credentials::SshKey]
def credentials def credentials_for(remote)
return unless File.exist? private_key return unless File.exist? private_key
Rugged::Credentials::SshKey.new username: username_for(origin), publickey: public_key, privatekey: private_key Rugged::Credentials::SshKey.new username: username_for(remote), publickey: public_key, privatekey: private_key
end end
# Obtiene el nombre de usuario para el repositorio remoto, por # Obtiene el nombre de usuario para el repositorio remoto, por