git upload files when encountered some problems

How to solve the git upload file error [rejected] master -> master (fetch first) error: failed to push some refs to '

 

 

The first question
to upload steps:
git the Add.
Git the commit -m "prompt message"
git the Push Origin Master

出错:
! [rejected] master -> master (fetch first) error: failed to push some refs to ' 。。。'

This problem occurs because README.md github file that is not in native code directory, you can merge the code using the command

git pull --rebase origin master

The second problem
! [Remote rejected] master -> master (pre-receive hook declined)

Error when pushing the code above, the online search to approach said setting project master is protected project, so developers can not push, the solution is to modify the protected settings, or create a new branch, pushed to their branch

Solution Articles

The third problem
git the Add.
Git the Push Origin Master

There has been such a problem everything up-to-date

The reason: git commit changes to the cache, you want to push, when not all of the local branches push off, so this problem. Then we need to create a new branch to submit a change and merge branches.

1. create a new branch commit changes
$ git branch newbranch

2. Check whether this command to create a successful
$ git branch

In this case the terminal will output:

newbranch

*master

This creates successful, in front of the * represents the current working branch where you are, then we must work to switch branches.

Checkout newbranch 3.git
4. Then commit your changes to the new branch
$ git add.

$ Git commit -m "message"

$ Git at this point you can check the status of submission. If the submission is successful, we are going back to the main branch of the next, $ git checkout master

5. We will change a new branch submitted merged into the master branch on
$ git merge newbranch

Merge branch may conflict which is normal, though this is our new branch will not conflict, but still recorded here. Can use

$ Git diff to view the file conflict, and then make the corresponding changes and then submit it once.

6. We solve the problem, then we can push the code
$ git push -u origin master

7. Finally, the new branch of Friends do not forget to delete the branch
$ git branch -D newbranch

If you want to keep the branch just want to delete some have merged as long as the uppercase D to lowercase d-line.

Summarize, I am in the process of uploading probably encountered several major issues, the Internet found a lot of solutions, found that even encountered the same problem, the solution may not apply themselves. Record it, look after and there is no other solution to the problem.

Guess you like

Origin www.cnblogs.com/anthony-wang0228/p/11454035.html