{"record":{"id":"c7aff7081612e6e6","repo":"FreshRSS/FreshRSS","slug":"error-return-during-git-checkout-to-edge-branch","errorCode":null,"errorMessage":"Error {$return} during git checkout to edge branch! ' . 'Please change branch manually!","messagePattern":"Error (.+?) during git checkout to edge branch! ' \\. 'Please change branch manually!","errorType":"exception","errorClass":"Minz_Exception","httpStatus":null,"severity":"error","filePath":"app/Controllers/updateController.php","lineNumber":50,"sourceCode":"\n\t\t//Note `git branch --show-current` requires git 2.22+\n\t\texec('git symbolic-ref --short HEAD 2>&1', $output, $return);\n\t\tif ($return != 0) {\n\t\t\tthrow new Minz_Exception(\"Error {$return} during git symbolic-ref: \" .\n\t\t\t\t'Reapply `chown www-data:www-data -R ' . FRESHRSS_PATH . '` ' .\n\t\t\t\t'or git pull manually! ' .\n\t\t\t\tjson_encode($output, JSON_UNESCAPED_SLASHES));\n\t\t}\n\t\t$line = implode('', $output);\n\t\tif ($line !== 'master' && $line !== 'dev') {\n\t\t\treturn true;\t// not on master or dev, nothing to do\n\t\t}\n\n\t\tMinz_Log::warning('Automatic migration to git edge branch');\n\t\tunset($output);\n\t\texec('git checkout edge --guess -f', $output, $return);\n\t\tif ($return != 0) {\n\t\t\tthrow new Minz_Exception(\"Error {$return} during git checkout to edge branch! ' .\n\t\t\t\t'Please change branch manually!\");\n\t\t}\n\n\t\tunset($output);\n\t\texec('git reset --hard FETCH_HEAD', $output, $return);\n\t\tif ($return != 0) {\n\t\t\tthrow new Minz_Exception(\"Error {$return} during git reset! Please git pull manually!\");\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic static function getCurrentGitBranch(): string {\n\t\t$output = [];\n\t\texec('git branch --show-current', $output, $return);\n\t\tif ($return === 0) {\n\t\t\treturn 'git branch: ' . $output[0];\n\t\t} else {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/FreshRSS/FreshRSS/blob/95842d81c1b8ab673389544f072559aeb8cd7591/app/Controllers/updateController.php#L32-L68","documentation":"The actual branch switch, exec('git checkout edge --guess -f'), returned non-zero. --guess derives the local 'edge' branch from a remote tracking branch; common failure causes: no remote 'edge' ref exists (old clone never fetched since the rename), a stale .git/index.lock from a crashed or concurrent git process, untracked files that even -f refuses to clobber, or the same dubious-ownership refusal as the other git steps.","triggerScenarios":"Clone predating the edge branch with no git fetch performed; a concurrent cron and web update racing on .git/index.lock; local modifications or untracked files conflicting with the checkout; safe.directory rejection.","commonSituations":"Long-lived git installs crossing the 1.18.0 branch rename; two update triggers firing simultaneously.","solutions":["As the web user run: git fetch origin && git checkout edge --guess -f","Remove a stale .git/index.lock when no git process is running","Commit, stash or clean local modifications if the checkout reports conflicts","Fix ownership/safe.directory as in the symbolic-ref error, then retry"],"exampleFix":"# before - auto checkout fails\nsudo -u www-data git -C /var/www/FreshRSS checkout edge --guess -f\nerror: pathspec 'edge' did not match any file(s)\n# after\nsudo -u www-data git -C /var/www/FreshRSS fetch origin\nsudo -u www-data git -C /var/www/FreshRSS checkout edge --guess -f","handlingStrategy":"try-catch","validationCode":"exec('git -C ' . escapeshellarg(FRESHRSS_PATH) . ' fetch origin 2>&1', $o, $rc);\nexec('git -C ' . escapeshellarg(FRESHRSS_PATH) . ' rev-parse --verify origin/edge 2>&1', $o2, $rc2);\nif ($rc !== 0 || $rc2 !== 0) {\n\techo 'origin/edge not available after fetch - resolve before migrating';\n\treturn;\n}","typeGuard":null,"tryCatchPattern":"try {\n\tFreshRSS_update_Controller::migrateToGitEdge();\n} catch (Minz_Exception $e) {\n\t// checkout step failed: fetch origin, clear index.lock, then retry or switch manually\n\tMinz_Log::error($e->getMessage());\n}","preventionTips":["Fetch origin before triggering the update on old git installs","Avoid triggering updates from two places at once (web + cron) to prevent index.lock races","Keep the working tree free of local modifications on auto-updated installs"],"tags":["update","git","branch","checkout"],"backgroundTag":"git-checkout-failed","analyzedSha":"95842d81c1b8ab673389544f072559aeb8cd7591","analyzedAt":"2026-08-23T00:21:00.265Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}