push到github时,每次都要输入用户名和密码的问题

简介:

问题


在github.com上 建立了一个小项目,可是在每次push 的时候,都要输入用户名和密码,很是麻烦
这里写图片描述

原因


原因是使用了https方式 push
这种方式产生的原因,一般是我们clone是一定是使用了http的方式
例如我们在github上创建了一个项目,然后我们clone到本地时使用了http而非git
这里写图片描述

我们可以看到右端的项目地址,默认是http的,clone时

git clone https://github.com/gatieme/AderSCloud.git
  • 1
  • 1

如果使用ssh的话,应该使用的路径是

git clone git://github.com/gatieme/AderSCloud.git
  • 1
  • 1

解决


在termail里边 输入

git remote -v 
  • 1
  • 1

可以看到形如一下的返回结果

origin  git@github.com:gatieme/AderSCloud.git (fetch)
origin  git@github.com:gatieme/AderSCloud.git (push)
  • 1
  • 2
  • 1
  • 2

下面把它换成ssh方式的。
移出旧的http的origin

git remote rm origin
  • 1
  • 1

添加新的git方式的origin
git remote add origin git@github.com:gatieme/AderSCloud.git

我们在查看一下push方式

git remote -v
  • 1
  • 1

这里写图片描述

再次push一下,已经不需要输入用户名密码了
git push origin 
  • 1
  • 2
  • 1
  • 2

这里写图片描述


转载:http://blog.csdn.net/gatieme/article/details/45033349

目录
相关文章
|
2月前
|
缓存 网络协议 Linux
百度搜索:蓝易云【解决github push/pull报错443】
通过以上方法,你有望解决GitHub push/pull报错443的问题。如果问题仍然存在,建议检查GitHub的状态页面,看是否有正在维护或故障的情况。
81 3
|
3月前
|
安全 API 网络安全
Github不再支持基于密码的API访问
Github不再支持基于密码的API访问
41 0
|
9月前
|
存储 开发工具 git
使用 git push 上传超过100MB文件报错 remote: error: this exceeds GitHub‘s file size limit of 100.00 MB
Git 大文件存储(LFS)用 Git 中的文本指针替换音频示例、视频、数据集和图形等大文件,同时将文件内容存储在 GitHub.com 或 GitHub Enterprise 等远程服务器上。
170 0
|
7月前
|
网络安全 开发工具 数据安全/隐私保护
GitHub不再支持密码验证解决方案:SSH免密与Token登录配置
今天提交代码,push到GitHub上,突然出现这个问题。 remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information. fatal: unable to acce
|
8月前
GitHub的PUSH显示网络超时,小乌龟网络代理办法
GitHub的PUSH显示网络超时,小乌龟网络代理办法
146 0
|
8月前
|
JavaScript 开发工具 git
vscode关于vue项目无法将文件push到github的错误命令
vscode关于vue项目无法将文件push到github的错误命令
69 0
|
开发工具 git Windows
GitHub push失败-Failed to connect to github.com port 443: Timed out
GitHub push失败-Failed to connect to github.com port 443: Timed out
GitHub push失败-Failed to connect to github.com port 443: Timed out
|
开发工具 数据安全/隐私保护 git
全网首发:github已经设置了令牌token,为什么还要验证用户密码
全网首发:github已经设置了令牌token,为什么还要验证用户密码
161 0
|
开发工具 数据安全/隐私保护 git
github每次push时自动输入用户名密码
github每次push时自动输入用户名密码
115 0
|
数据安全/隐私保护