two computers, pc1 pc2.
pc1 push project1 to https://xxxx@github.com/xxxx/.
git init
git add project1/
git commit -m "from pc1"
git remote add origin ttps://xxxx@github.com/xxxx/yyyy.git
git push -u origin master
succeeded.
now you need to use the same code on pc2 under https://xxxx@github.com/xxxx/.
from project2, push above pc2
git init
git add project2/
git commit -m "from pc1"
git remote add origin https://xxxx@github.com/xxxx/yyyy.git
git push -u origin master
error
error: failed to push some refs to" https://xxxx@github.com/xxxx/."
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., "git pull.") Before pushing again.
hint: See the "Note about fast-forwards" in" git push-- help" for details.
Code modified to
rm -rf .git
git init
git add project2/
git commit -m "from pc1"
git remote add origin https://xxxx@github.com/xxxx/yyyy.git
git pull
git push -u origin master
error report:
error: failed to push some refs to" https://xxxx@github.com/xxxx/."
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (employees
hint: "git pull.") Before pushing again.
hint: See the "Note about fast-forwards" in" git push-- help" for details.
code continues to be modified to
rm -rf .git
git init
git add project2/
git commit -m "from pc1"
git remote add origin https://xxxx@github.com/xxxx/yyyy.git
git pull origin master
From https://xxxx@github.com/xxxx/yyyy.git
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
fatal: refusing to merge unrelated histories
git push -u origin master
error: failed to push some refs to "https://xxxx@github.com/xxxx/yyyy.git"
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (employees
hint: "git pull.") Before pushing again.
hint: See the "Note about fast-forwards" in" git push-- help" for details.
excuse me, how to solve this problem?