GIT cannot commit code

Source: Internet
Author: User
Tags commit using git

GitHub is a good website that can be managed with open source code. Recently, however, I encountered a problem when I submitted the code, using Git's three common commands:

git add source file noun
git commit source file noun-m comment
git push-u origin Master

But the code did not commit to GitHub as expected, but the error message appeared.
The error message is as follows:

maya@maya-g450:~/myvimrc$ git add tag_vim.sh maya@maya-g450:~/myvimrc$ git commit tag_vim.sh-m "add a script for Ctags and Cscope generation "[Master bfe6081] Add a script for ctags and cscope Generation 1 file changed, one insertions (+) C  reate mode 100755 tag_vim.sh maya@maya-g450:~/myvimrc$ git push-u Origin Master warning:permanently added the RSA host
Key for IP address ' 192.30.255.112 ' to the list of known hosts. To Git@github.com:astbl123/myvimrc.git! [Rejected] Master-and master (fetch first) Error: Unable to push some references to ' git@github.com:astbl123/myvimrc.git ' hint: Update is denied because the remote repository Contains commits that you do not already exist locally. This is usually due to another hint: a warehouse has been pushed to the reference.
Before you push again, you may need to consolidate the remote change prompt first: (such as ' git pull ... ').
Tip: See the ' Note about Fast-forwards ' section in ' Git Push--help '.
  maya@maya-g450:~/myvimrc$ git status is located in branch Master your branch leading ' origin/master ' a total of 1 commits. (use "Git push" to publish your local submission) No files to submit, clean workspace maya@maya-g450:~/myvimrc$ git commit-m "Add a script for ctags and Cscope Gener
  ation "in branch Master your branch leading ' origin/master ' a total of 1 submissions. (Using the GIT push "to publish your local commits" No files to submit, clean workspace maya@maya-g450:~/myvimrc$ git push-u Origin Master warning:permanently added the RSA h
OST key for IP address ' 192.30.255.113 ' to the list of known hosts. To Git@github.com:astbl123/myvimrc.git! [Rejected] Master-and master (fetch first) Error: Unable to push some references to ' git@github.com:astbl123/myvimrc.git ' hint: Update is denied because the remote repository Contains commits that you do not already exist locally. This is usually due to another hint: a warehouse has been pushed to the reference.
Before you push again, you may need to consolidate the remote change prompt first: (such as ' git pull ... '). Tip: See the ' Note about Fast-forwards ' section in ' Git Push--help '.

The

is prompted by the update is denied because the remote warehouse contains commits that you do not already exist locally. This is usually because "it is possible that GitHub may be out of sync with the local code and need to update the remote server's code locally."
Workaround: Enter the command git pull to update the code on GitHub locally.

maya@maya-g450:~/myvimrc$ git pull remote:counting objects:3, done. Remote:total 3 (Delta 0),
Reused 0 (Delta 0), pack-reused 3 unpacking objects:100% (3/3), done. From GITHUB.COM:ASTBL123/MYVIMRC eba0b74. 6F02BC7 Master, Origin/master added Cscope database/home/maya/cscope.out Press Enter or other command to continue the Merge made by the ' recursive
 ' Strategy. readme.md | 1 + 1 file changed, 1 insertion (+) maya@maya-g450:~/myvimrc$ maya@maya-g450:~/myvimrc$ maya@maya-g450:~/myvimrc$ maya@
maya-g450:~/myvimrc$ maya@maya-g450:~/myvimrc$ git push-u Origin master counting Objects:8, done.
Delta compression using up to 2 threads.
Compressing objects:100% (5/5), done. Writing objects:100% (5/5), 879 bytes |
0 bytes/s, done. Total 5 (delta 0), reused 0 (Delta 0) to Git@github.com:astbl123/myvimrc.git 6F02BC7. 5B168FC Master-and Master branch master is set to track the remote branch master from Origin. 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.