About the problem of local code submitting github

I created a folder locally and put it into a document. Then the specific steps are as shown in the figure above. Set ssh-key, first, and then follow the general step git init, git add.. , git commit-m "dd",git remote add origin,git pull origin master,git push oritin master, tried different steps and methods several times and failed to upload the code. I used the github address of https. I"ve tried git push-- upstream, too.
reported an error:
failed to push some refs to" https://github.com/gipal/dd.git"
Updates were rejected because the tip of your current branch is behind
its remote counterpart.. Integrate the remote changes (employees
"git pull.") Before pushing again.
See the "Note about fast-forwards" in" git push-- help" for details.

I can"t even try git pull. I can"t thank you enough for your help. Thank you very much.

Jan.13,2022

the reason for this is that your local warehouse and remote warehouse are two separate libraries. If you used to build a local clone of a remote github repository in a direct clone way, you wouldn't have this problem.

solution: use the-- allow-unrelated-history option immediately after the pull command

git pull origin master --allow-unrelated-histories

the landlord can try this command git push-u origin master-f


execute git push origin master error error: failed to push some refs to.

solution: most of the README.md files in github are not in the local code directory. Merge them through git pull-rebase origin master, and then upload them via git push-u origin master

.

just git pull origin master and try again.

Menu