First time git push

I would like to push a loacal git respository to my github account.

git push origin master

What is master exactly?
Is it the name that is listed in the dropdown next to branch and tags? There it says main in my case.

How can I provide the credentials?
If I exceute

git push origin main

This window is poping up. What should I choose?

login

I tried already some options, but getting this error always:

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see Token authentication requirements for Git operations | The GitHub Blog for more information.
fatal: Authentication failed for ‘https://github.com/user/respository.git/

It’s the refspec to push, in the simplest case (like here) the name of the branch or tag you want to push. If your branch is called main you need to change the command like you did. :slightly_smiling_face:

That window is asking you whether to store the credentials you enter, and if yes, how. Storing them tends to be convenient but can be a security tradeoff.

If you entered your password, you need to create a Personal Access Token and use that instead, as described in the changelog entry linked in the error message.

Thanks for your answer! Connecting to GitHub is working now.
Unfortunately I am getting a merge conflict now

fatal: Need to specify how to reconcile divergent branches.

and after executing git config pull.rebase false

fatal: refusing to merge unrelated histories

Both branches are called master now. The respository on Github contains just the readme file. Locally the project is stored.
What could be wrong?

That sounds like you initialized the repository with a README when creating it on GitHub, but didn’t pull that before starting work locally. Either way around is fine, but you should start at one side and push/pull to the other before continuing. Otherwise you get what the error message is warning you about: Commit histories without a common origin (initial commit). When you already have local commits it’s generally best to create the remote repository without any initialization.

Right now your best option is probably to copy the README to your local repository and commit it there (assuming you want to keep it), and then force-push. A force-push deletes conflicting remote commits, so double-check that the remote repository doesn’t have anything on the target branch that you want to keep. :warning: