2015 March 19

解决Git每次Push需用户名登录问题

最近突然发现Push要登录用户名与密码,操作体验下降得很厉害,Google之发现是Git采用了Https的方式登录了,应该是自己把原来的项目删除了然后采用了git clone https在直接在克隆文件下操作提交,导致原先的SSH失效了,遂在此更改回SSH验证方式:

主要操作指令:

git remote

$ git remote -help
usage: git remote [-v | --verbose]
   or: git remote add [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mir
ror=<fetch|push>] <name> <url>
   or: git remote rename <old> <new>
   or: git remote remove <name>
   or: git remote set-head <name> (-a | --auto | -d | --delete |<branch>)
   or: git remote [-v | --verbose] show [-n] <name>
   or: git remote prune [-n | --dry-run] <name>
   or: git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)..
.]
   or: git remote set-branches [--add] <name> <branch>...
   or: git remote set-url [--push] <name> <newurl> [<oldurl>]
   or: git remote set-url --add <name> <newurl>
   or: git remote set-url --delete <name> <url>

    -v, --verbose         be verbose; must be placed before a subcommand

$ git remote rm origin

$ git remote add origin git@github.com:itlipan/itlipan.github.com

$ git push origin

$ git remote  -v
origin  git@github.com:itlipan/itlipan.github.com (fetch)
origin  git@github.com:itlipan/itlipan.github.com (push)

更改完毕,再次Push测试,无需再次输入用户名密码

上一篇
下一篇
Loading Disqus comments...
Table of Contents