Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When push in github, why git didn't ask me to type username and password?

Tags:

git

github

This might be stupid question. But I could't find anything about this by search. Maybe, this is stupid question.

I've stored my codes in github.

2 hours ago, I want update my codes in repository, but my local doesn't have that code. So I cloned it, modified codes, and pushed it. At this time, git prompt me to type user name of github and password. I typed it and code updated.

After that, I read my codes in "OTHER" repository. And I found something needed to modify, too. So I cloned that repository to my local computer, modified codes, and pushed it.

But... at this time, git does not prompt message to input user name and password of github.

Huh? Is this mean that anyone cloned my codes in github could also push to my github repository? This is very dangerous situation, isn't it?

So I tested with creating new repository in github. I cloned this new repository to my local, made some change, and pushed it. But git does not prompt message to type user name and password, too.

So, my question is,

  1. Does the first pushing save github login information in my local computer, and use it after other push? Then, where it is?
  2. What is the github repository's default security setting? I didn't register SSH key of this local computer to github account. It seems irrational to anyone push to my repository with master branch, without any requirement of authentication.

Below is my commands when doing above works.

$git init
$git clone https://github.com/[user name]/[repository name].git
<some change>
$git add *
$git commit -m "change"
$git remote add origin https://github.com/[user name]/[repository name].git
$git push origin master

Added information. For more details, I captured my github setting pages.

enter image description here

enter image description here

enter image description here

like image 830
casamia Avatar asked Aug 03 '15 17:08

casamia


2 Answers

You can manually unset credential.helper by running below command.

git config --global --unset credential.helper

use --global or --local or --system as per your needs.

Then pushing in github will ask for username and password.

If you are on windows one other way to do this is as below but note that it will again save your credentials if you use credential.helper with git.

Go to control panel -> Credential Manager -> Windows Credentials and remove your git credential entry/entries. enter image description here

like image 172
Foolish Avatar answered Oct 25 '22 06:10

Foolish


For Mac users password can be clear by running below command :

git credential-osxkeychain erase
host=github.com
protocol=https
like image 22
ireshika piyumalie Avatar answered Oct 25 '22 08:10

ireshika piyumalie