8

I have added my self to the git bash program but can't find on google how to login?

$ git config --global user.name "myname"
$ git config --global user.email [email protected]
0

1 Answer 1

15

The user.name and user.email have nothing to do with login credentials.
They are metadata attached to your commits.

To "login", you need to add a remote url which will use your credentials, either https or ssh one.

git remote add origin https://UserName:[email protected]/UserName/yourRepo.git
                                 ^
                                 |
                              (credentials)

Or ssh:

git remote add origin [email protected]/UserName/yourRepo.git

(which would means that you have in HOME/.ssh your id_rsa and id_rsa.pub private and public key, with the public key registered in your GitHub account: see "Generating SSH Keys")


See more at "Which remote URL should I use?".

As noted by paddymac in the comments, if origin already exists, use git remote set-url origin instead of git remote add origin

1
  • To add on to this. If you have already cloned your repo and you get the error "Remote origin already exists", then use 'git set-url' as opposed to 'git add'
    – Paddymac
    Feb 13, 2020 at 12:07

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.