Git Remotes
You want to set up the git repo on your laptop so that:
- when you are on branch
mainand you dogit pullthen it comes from theteacherrepo - when you are on branch
pythonand yougit pushit goes to themainbranch on your student repo.
Here are the steps to achieve that.
I first made a repo called test-teacher-repo on Forgejo.
Clone the repo to your laptop and name it
test-student-repogit clone ssh://forgejo@git.auc-computing.nl/bon/test-teacher-repo.git test-student-repo cd test-student-repoAdd the student remote. Use your own Forgejo repo here.
git remote add student ssh://forgejo@git.auc-computing.nl/bon/test-student-repo.gitCreate the
pythonbranchgit checkout -b pythonConfigure pull behavior for
maingit config branch.main.remote origin git config branch.main.merge refs/heads/main(This is likely already set by the clone, but this makes it explicit.)
Configure push behavior for
python→student/maingit config branch.python.remote student git config branch.python.merge refs/heads/main git config branch.python.pushRemote studentThen to ensure it pushes to
main(notpython) on the remote, set the push refspec. Also prevent git from grumbling about cherry picks.git config remote.student.push refs/heads/python:refs/heads/main git config set advice.skippedCherryPicks falseVerify
git remote -v git config --list | grep branch
Now when you are on branch main and you do git pull then it comes from teacher and when you are on branch python and you git push it goes to the main branch on your student repo.