E
E
ebaysher2021-05-05 09:51:14
git
ebaysher, 2021-05-05 09:51:14

I can't push. Gives an error message. How to solve this problem?

$ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin master

after typing the command above:

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

I've been googling for an hour now and can't figure out what the problem is.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
HemulGM, 2021-05-05
@HemulGM

They wrote to you in the "Russian" language, your branch is lagging behind. First tighten the changes, join, commit, and then push

I
Ivan Koryukov, 2021-05-05
@MadridianFox

When creating a repository in the github, you clicked/left the "create readme.md" checkbox.
This led to the fact that the first commit appeared in the github in the repository.
At the same time, you also committed locally.
Now you have locally and in github the master starts with different commits. Not sure if a simple git pull will help here.
You need to delete the repository in the github and create it again, without any files there. Then you can push local commits there.

N
Nikolay Barkalov, 2021-12-03
@NikolayBarkalov

I have corrected. Ivan Koryukov prompted the answer . Indeed, when you checked readme.md, GitHub created a "main" branch. Create a branch with the command "git push -u origin <your branch name" and then push from the branch (maybe after looking at the GitHub site in the project section -> branch selection). Ivan Koryukov thanks for the indirect answer. It worked for me!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question