当推入github时,为什么git没有要求我输入用户名和密码? [英] When push in github, why git didn't ask me to type username and password?

查看:397
本文介绍了当推入github时,为什么git没有要求我输入用户名和密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是个愚蠢的问题。但我无法通过搜索找到任何关于此的信息。也许,这是一个愚蠢的问题。



我在github中存储了我的代码。

2小时前,我想更新存储库中的代码,但我的本地没有该代码。所以我克隆了它,修改了代码,然后推送它。这时,git提示我输入github的用户名和密码。我输入它并更新代码。

之后,我在其他存储库中读取我的代码。我也发现需要修改的东西。于是我将该存储库克隆到本地计算机,修改了代码,并将其推送。



但是...在这个时候,git不会提示消息输入github的用户名和密码。



咦?这是否意味着任何人在github中克隆我的代码也可能会推送到我的github存储库?这是非常危险的情况,不是吗?

所以我测试了在github中创建新的存储库。我把这个新的存储库克隆到我的本地,做了一些改变,并推动它。但是,git不会提示消息输入用户名和密码。



所以,我的问题是,


  1. 第一次推送是否将github登录信息保存在本地计算机中,并在其他推送后使用它?那么,它在哪里?

  2. 什么是github存储库的默认安全设置?我没有将本地计算机的SSH密钥注册到github帐户。任何人推送到我的存储库与主分支似乎不合理,没有任何身份验证的要求。

以上是我在执行上述操作时的命令。

  $ git init 
$ git clone https://github.com/[user name] / [存储库名称] .git
<一些变化>
$ git add *
$ git commit -mchange
$ git remote add origin https://github.com/[user name] / [repository name] .git
$ git push origin master






新增信息。
有关更多详细信息,我抓住了我的github设置页面。







解决方案

这可能有帮助..
https://help.github.com/articles/caching-your-github-password-in-git/



Git默认保存你的密码缓存15分钟。

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.

解决方案

This might help.. https://help.github.com/articles/caching-your-github-password-in-git/

Git by default saves your passwd in cache for 15 min.

这篇关于当推入github时,为什么git没有要求我输入用户名和密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆