Git failed to submit data error: failed to push some refs to’https://github.com/XXXXXXX/gif.git’

Load code cloud use tutorial address: http://www.jianshu.com/p/084e0aabbab3
Problem a: execute the Git remote add origin https://github.com/XXXXXXX/gif.git
Fatal: Remote Origin Already exists.
When this problem occurs, Git Remote displays all the remote libraries and USES the command Git Remote RM Origin to delete the origin.

Issue 2: git push-u origin master pushes the local repository to github
fatal: I don’t handle protocol ‘git@https’
This problem, use the command git remote add origin http://github.com/XXXXXXX/gif.git.

question 3: perform $git push -u origin master
the Username for ‘https://github.com/XXXXXXX/gif.git’
! [rejected] master – & gt; Master (the fetch first)
error: failed to push some refs to ‘https://github.com/XXXXXXX/gif.git’
hint: Updates were rejected because the remote contains work that you do
hint: Not have mature. 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-forward ‘in ‘git push –help’ for details.
The main reason for the error is that there is already a README file on git repository, so there may be conflicts during submission. In this case, you need to choose to keep the online file or discard the online file. If you discard the online document, you need to choose to force push when pushing, which requires the following command

git push origin master -f

If you choose to keep the readME file online, you need to execute it first

git pull origin master

Git usage steps:

Build a new ABC warehouse on GitHub.
Create a Git repository locally:
1, the mkdir ABC
2, CD ABC
3, git init
4. Add file (file)
5, Git add file1 file2 file…
6. Git-commit-m “Add Files”
7, git remote add origin https://git.oschina.net/xxx/abc.git
8. Git push-U Origin Master
Here, an error message appears:
error: failed to push some refs to ‘https://git.oschina.net/xxx/abc.git’
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. ‘git pull’)
hint: before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push –help’ for details.
The push failed because a READme.md file was initialized on GitHub. The files in the remote repository are newer than the local ones, so to use Git Pull you need to grab the latest file, merge it with the local file and commit it.
9, the git pull
Error:
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 3 (delta 0)
Unpacking objects: 100% (3/3), done.
From github.com:michaelliao/learngit
fc38031.. 291 bea8 dev – & gt; origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull < remote> < branch>
The reason is that there is no connection between the local master and the remote Origin /master.
10. Set up the connection
$ git branch –set-upstream master origin/master
11, the git pull
12. Then submit
git commit -m “merge README.MD”
13. Git push-U Origin Master completed local uploading to remote warehouse

Read More: