@param string $repository
@param string $model
@param string $path

@throws Exception
192929
public function create(string $repository, string $model, string $path = '')
    {
        $this->setNamespace($repository);

        $this->setModel($model);

        $this->setRepository($repository);

        $this->setPath($path);

        //check file exists
        if ($this->fileSystem->exists($this->repositoryFilePath())) {
            throw new Exception("File {$this->repositoryFilePath()} exists");
        }

        //create directory
        $this->autoCreateDirectory();

        //write file
        $this->writeStubFile($this->getFormatStubFileContent());
    }
766166
public function mkdir( $path )
	{
		try {
			$this->fs->makeDirectory( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
168879
public function doDownload(PackageInterface $package, $path, $url)
    {
        GitUtil::cleanEnv();
        $path = $this->normalizePath($path);

        if (!$this->isRequiredRepository($path, $url)) {
            throw new FilesystemException('Unknown repository installed into ' . $path);
        }

        $ref = $package->getSourceReference();
        if ($this->io->isVerbose()) {
            $this->io->write('    Multi-repository path: ' . $path);
        }
        if (!$this->isRepositoryCloned($path)) {
            $this->io->write('    Multi-repository GIT directory not found. Cloning...');
            $this->cloneRepository($package, $path, $url);
        } else {
            $this->io->write('    Multi-repository GIT directory found. Fetching changes...');
            $this->fetchRepositoryUpdates($package, $path, $url);
        }

        if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
            if ($package->getDistReference() === $package->getSourceReference()) {
                $package->setDistReference($newRef);
            }
            $package->setSourceReference($newRef);
        }

        //copy file into required directory
        $this->copyFilesToDefaultPath($path);
    }
359209
public function setModel(Repository $model, $default = null, $customName = null)
    {
        $this->setRepository($model, $default, $customName);

        return $this;
    }
926223
public function load(Model $m, $id, $table = null)
    {
        if (isset($m->table) && !isset($this->data[$m->table])) {
            throw new Exception([
                'Table was not found in the array data source',
                'table' => $m->table,
            ]);
        }

        if (!isset($this->data[$table ?: $m->table][$id])) {
            throw new Exception([
                'Record with specified ID was not found',
                'id' => $id,
            ], 404);
        }

        return $this->tryLoad($m, $id, $table);
    }
314495
public function set_repo_path($repo_path, $create_new = false, $_init = true) {
		if (is_string($repo_path)) {
			if ($new_path = realpath($repo_path)) {
				$repo_path = $new_path;
				if (is_dir($repo_path)) {
					// Is this a work tree?
					if (file_exists($repo_path."/.git") && is_dir($repo_path."/.git")) {
						$this->repo_path = $repo_path;
						$this->bare = false;
					// Is this a bare repo?
					} else if (is_file($repo_path."/config")) {
					  $parse_ini = parse_ini_file($repo_path."/config");
						if ($parse_ini['bare']) {
							$this->repo_path = $repo_path;
							$this->bare = true;
						}
					} else {
						if ($create_new) {
							$this->repo_path = $repo_path;
							if ($_init) {
								$this->run('init');
							}
						} else {
							throw new \Exception('"'.$repo_path.'" is not a git repository');
						}
					}
				} else {
					throw new \Exception('"'.$repo_path.'" is not a directory');
				}
			} else {
				if ($create_new) {
					if ($parent = realpath(dirname($repo_path))) {
						mkdir($repo_path);
						$this->repo_path = $repo_path;
						if ($_init) $this->run('init');
					} else {
						throw new \Exception('cannot create repository in non-existent directory');
					}
				} else {
					throw new \Exception('"'.$repo_path.'" does not exist');
				}
			}
		}
	}
593081
public static function driver(string $driver, AbstractRepository $repository): RepositoryDriver
    {
        switch ($driver) {
            case 'eloquent':
                return new Eloquent($repository);
            default:
                throw new InvalidArgumentException("Driver [{$driver}] not found");
        }
    }
154507
public function main()
    {
        if (null === $this->getRepository()) {
            throw new BuildException('"repository" is required parameter');
        }

        $client = $this->getGitClient(false, $this->getRepository());
        $command = $client->getCommand('push');
        $command
            ->setOption('tags', $this->isTags())
            ->setOption('mirror', $this->isMirror())
            ->setOption('delete', $this->isDelete())
            ->setOption('q', $this->isQuiet())
            ->setOption('force', $this->isForce());

        // set operation target
        if ($this->isAllRemotes()) { // --all
            $command->setOption('all', true);
            $this->log('git-push: push to all refs', Project::MSG_INFO);
        } elseif ($this->isMirror()) { // <repository> [<refspec>]
            $command->setOption('mirror', true);
            $this->log('git-push: mirror all refs', Project::MSG_INFO);
        } elseif ($this->getDestination()) { // <repository> [<refspec>]
            $command->addArgument($this->getDestination());
            if ($this->getRefspec()) {
                $command->addArgument($this->getRefspec());
            }
            $this->log(
                sprintf(
                    'git-push: pushing to %s %s',
                    $this->getDestination(),
                    $this->getRefspec()
                ),
                Project::MSG_INFO
            );
        } else {
            throw new BuildException('At least one destination must be provided');
        }

        $this->log('git-push command: ' . $command->createCommandString(), Project::MSG_INFO);

        try {
            $output = $command->execute();
        } catch (Exception $e) {
            throw new BuildException('Task execution failed.', $e);
        }

        $this->log('git-push: complete', Project::MSG_INFO);
        if ($this->isDelete()) {
            $this->log('git-push: branch delete requested', Project::MSG_INFO);
        }
        $this->log('git-push output: ' . trim($output), Project::MSG_INFO);
    }
328209
public function publish(string $path)
    {
        if (!is_dir($path)) {
            throw new \Exception("Bad path ($path)");
        }
        $this->recurseCopy($path, base_path('public/'));
    }
249213
public function run($command, $repository = null, $force = false)
    {
        list($stdout, $status, $stderr) = parent::run($command, $repository);
        if (!empty($stderr)) {
            throw new GitRuntimeException($stderr);
        }
        return $stdout;
    }
880867
protected function checkPermission(self $layout, Repository $repository): bool
    {
        return method_exists($layout, 'canSee') && $layout->canSee($repository);
    }
797496
private function initComposerJson($path, $repositoryUrl, $packageName)
    {
        $json = [];
        $composerJson = $path.'/composer.json';
        if (file_exists($composerJson)) {
            $json = json_decode(file_get_contents($composerJson), true);
        }

        if (!isset($json['name'])) {
            $json['name'] = $packageName;
        }

        if (!isset($json['version'])) {
            $json['version'] = '0.0.1';
        }

        if (!isset($json['repositories'])) {
            $json['repositories'] = [['type' => 'git', 'url' => $repositoryUrl]];
        } else {
            $hasRepositoryUrl = false;
            foreach ($json['repositories'] as $item) {
                if ($item['type'] == 'git') {
                    $hasRepositoryUrl = true;
                    break;
                }
            }
            if (!$hasRepositoryUrl) {
                $json['repositories'][] = ['type' => 'git', 'url' => $repositoryUrl];
            }
        }

        $size = file_put_contents(
            $composerJson,
            json_encode(
                $json,
                JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES
            )
        );

        if (!$size) {
            $this->error("Error to write file '{$composerJson}'.");
        }
    }
1100900
function OpenyAddFork($path, $repository) {
    $this->taskComposerConfig()
      ->dir($path . '/openy-project')
      ->repository(99, $repository, 'path')
      ->ansi(TRUE)
      ->run();
  }
931623
public function post($path, $data, $mode = "post")
    {
        

        $this->resetDebug();
        $this->debug("url", $this->url . $path);
        if (is_string($data)) {
            if (!$data = json_decode($data)) {
                throw new \Exception("data is string but no JSON");
            }
        }
        

       
        $curl_post_data = $data;

        $curl = curl_init($this->url . $path);
        
     
       // echo "authmode=" . $this->authMode;
        
        $this->setupCurl($curl);
        
        // use for loaclahost
           curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
           curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,false);

        
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

        switch ($mode) {
            case 'put':
                curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
                break;

            default:
                curl_setopt($curl, CURLOPT_POST, true);
                break;
        }

        $this->debug("mode", strtoupper($mode));

        if ($this->postFormat == "json") {
            $curl_post_data = json_encode($curl_post_data);
        }

        
      
        
        curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
        
       // use for loaclahost
           curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
           curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,false);

        
        $curl_response = curl_exec($curl);
       
     
        
        $headers = curl_getinfo($curl);
        curl_close($curl);

        $this->debugEndTimer();
        return $this->returnResult($curl_response, $headers);

    }
107335
public function main()
    {
        if (null === $this->getRepository()) {
            throw new BuildException('"repository" is required parameter');
        }

        $client = $this->getGitClient(false, $this->getRepository());
        $command = $client->getCommand('gc');
        $command
            ->setOption('aggressive', $this->isAggressive())
            ->setOption('auto', $this->isAuto())
            ->setOption('no-prune', $this->isNoPrune());
        if ($this->isNoPrune() == false) {
            $command->setOption('prune', $this->getPrune());
        }

        // suppress output
        $command->setOption('q');

        $this->log('git-gc command: ' . $command->createCommandString(), Project::MSG_INFO);

        try {
            $command->execute();
        } catch (Exception $e) {
            throw new BuildException('Task execution failed', $e);
        }

        $this->log(
            sprintf('git-gc: cleaning up "%s" repository', $this->getRepository()),
            Project::MSG_INFO
        );
    }
793742
public function rmdir( $path )
	{
		try {
			$this->fs->deleteDirectory( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
1280154
public function main()
    {
        if (null === $this->getRepository()) {
            throw new BuildException('"repository" is required parameter');
        }

        if (null === $this->getTargetPath()) {
            throw new BuildException('"targetPath" is required parameter');
        }

        $files = @scandir($this->getTargetPath());
        if (isset($files) && is_array($files) && (count($files) > 2)) {
            throw new BuildException(
                sprintf(
                    '"%s" target directory is not empty',
                    $this->getTargetPath()
                )
            );
        }

        try {
            $this->doClone($this->getGitClient(false, getcwd()));
        } catch (Exception $e) {
            throw new BuildException('The remote end hung up unexpectedly', $e);
        }

        $msg = 'git-clone: cloning '
            . ($this->isBare() ? '(bare) ' : '')
            . ($this->hasDepth() ? ' (depth="' . $this->getDepth() . '") ' : '')
            . '"' . $this->getRepository() . '" repository'
            . ' to "' . $this->getTargetPath() . '" directory';
        $this->log($msg, Project::MSG_INFO);
    }