Skip to content

Commit 4816a03

Browse files
authored
Update pushing branch (#196)
1 parent 79be922 commit 4816a03

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/NewCommand.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ protected function pushToGitHub(string $name, string $directory, InputInterface
269269

270270
$commands = [
271271
"gh repo create $name -y $flags",
272-
'git push -q -u origin main',
272+
"git -c credential.helper= -c credential.helper='!gh auth git-credential' push -q -u origin main",
273273
];
274274

275-
$this->runCommands($commands, $input, $output);
275+
$this->runCommands($commands, $input, $output, ['GIT_TERMINAL_PROMPT' => 0]);
276276
}
277277

278278
/**
@@ -325,9 +325,10 @@ protected function findComposer()
325325
* @param array $commands
326326
* @param \Symfony\Component\Console\Input\InputInterface $input
327327
* @param \Symfony\Component\Console\Output\OutputInterface $output
328+
* @param array $env
328329
* @return \Symfony\Component\Process\Process
329330
*/
330-
protected function runCommands($commands, InputInterface $input, OutputInterface $output)
331+
protected function runCommands($commands, InputInterface $input, OutputInterface $output, array $env = [])
331332
{
332333
if ($input->getOption('no-ansi')) {
333334
$commands = array_map(function ($value) {
@@ -349,7 +350,7 @@ protected function runCommands($commands, InputInterface $input, OutputInterface
349350
}, $commands);
350351
}
351352

352-
$process = Process::fromShellCommandline(implode(' && ', $commands), null, null, null, null);
353+
$process = Process::fromShellCommandline(implode(' && ', $commands), null, $env, null, null);
353354

354355
if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) {
355356
try {

0 commit comments

Comments
 (0)