How to Fix GIT Push Error

problem 1:

after creating a new local branch, push the local branch to the remote library, and report an error

when using git pull or git push

gitThere 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>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> merged0.9.6

because there is no connection between the local branch and the remote branch (you can see the association between the local branch and the remote branch using git branch-vv). At the command line prompt, simply execute the following command to

git branch --set-upstream-to=origin/ upstream/local branch name

View all branches of local and remote repositories
git branch -a
view branches of remote repositories
git branch -r


problem 2
git push again,

 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/caizelin111/securitydemo'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Solutions:

1, the git pull origin master – allow – unrelated – nothing// the remote warehouse and local synchronization, eliminate the differences between </ p>

2, readd and commit corresponding files

3, git push origin master

4, at this point can upload successfully


Read More: