vito/app/SSH/Git/Git.php
Saeed Vaziry cdbde063f0
use blade as conmmands template (#444)
* use blade as conmmands template

* fix lint

* fix ssl
2025-01-27 21:27:58 +01:00

43 lines
979 B
PHP

<?php
namespace App\SSH\Git;
use App\Exceptions\SSHError;
use App\Models\Site;
class Git
{
/**
* @throws SSHError
*/
public function clone(Site $site): void
{
$site->server->ssh($site->user)->exec(
view('ssh.git.clone', [
'host' => str($site->getFullRepositoryUrl())->after('@')->before('-'),
'repo' => $site->getFullRepositoryUrl(),
'path' => $site->path,
'branch' => $site->branch,
'key' => $site->getSshKeyName(),
]),
'clone-repository',
$site->id
);
}
/**
* @throws SSHError
*/
public function checkout(Site $site): void
{
$site->server->ssh($site->user)->exec(
view('ssh.git.checkout', [
'path' => $site->path,
'branch' => $site->branch,
]),
'checkout-branch',
$site->id
);
}
}