I have 2 cloned repos and I am to build and generate executables (One single result file inside each repo) for each of them and push them onto a new repo. I encountered problem that the entire cloned repo + build artifact got pushed to the new repo. I only want the build artifacts in the new repo. Where in my git workflow is wrong?
git clone -> build -> git remote add new repo -> git add build artifact -> git commit -> git push new repo --force
You're committing the built executables back to the original repo (the one where you got the source code). If you want a repo that's just the built executables, then you'll need to put those built executables in a separate repo.
(This is what you've asked for, but I think you'll do better to use an artifact or container registry, or even a cloud storage bucket, instead of Git for your binaries.)