Error while pulling from Forked repository

AI-generated summary

The user akhilgopinath is encountering an error while trying to pull code from a forked Discourse repository, specifically during the git config --remove-section branch.tests-passed command, which fails with exit code 128. The issue occurs during the app rebuild process, with the error message indicating a failure in the pups/exec_command.rb script. The user has shared their app.yml configuration, which includes hooks to remove and reconfigure Git branches and remotes. simon suggests that the error might be due to incorrect syntax in the git branch -u command, recommending the removal of the branch name at the end. They also advise using a plugin instead of forking the repository to avoid such complications.

I was trying to pull the code from discourse forked version , i updated app.yml file with my github repository but when rebuild app i am getting this error

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && git config --remove-section branch.tests-passed failed with return #<Process::Status: pid 274 exit 128>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params {"cd"=>"$home", "cmd"=>["git remote remove origin", "git config --remove-section branch.master", "git config --remove-section branch.tests-passed", "git remote add origin https://github.com/akhilgopinath/discourse.git", "git fetch", "git remote set-branches --add origin tests-passed", "git remote set-branches --add origin master", "git branch -u origin/master master", "git branch -u origin/tests-passed tests-passed", "git reset --hard origin/master", "git reset --hard origin/tests-passed"]}
6e310eb9e7118b3c581192a00c1a6a552364e9db09dba5238b20b13aab8d0f3f
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

my app.yml is this

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
    - exec:
        cd: $home
        cmd:
          - git remote remove origin
          - git config --remove-section branch.master
          - git config --remove-section branch.tests-passed
          - git remote add origin https://github.com/akhilgopinath/discourse.git
          - git fetch
          - git remote set-branches --add origin tests-passed
          - git remote set-branches --add origin master
          - git branch -u origin/master master
          - git branch -u origin/tests-passed tests-passed
          - git reset --hard origin/master
          - git reset --hard origin/tests-passed

can you please help me on this ?

I’m not a git expert, but I think that to make the current existing branch track a new remote branch, you don’t include the branch name at the end of the -u command. Try:

- git branch -u origin/master
or
- git branch -u origin/tests-passed

You could probably save yourself a lot of trouble by making the changes you need in a plugin instead of forking the repo.