git 的账号密码错误情况

error

前段时间使用 phpstrom 中的 git 出现了一个错误

1
2
3
4
	Fetch failed
		error: unable to read askpass response from '..\tmp\intellij-git-askpass.bat'
		error: failed to execute prompt script (exit code 1)
		fatal: could not read Username for 'http://xxx:3000': No error

大体情况就是某一次操作的时候账户密码发生了变动,导致本地的 git 没权限去拉取远程库了(因为用的是 https) 的方式

解决

第一种(推荐): 将远程地址换成 ssh 地址,使用 ssh-key 登录

第二种: 实在不想换的话就是用这种方式

1
git remote set-url origin https://<username>:<password>@github.com/<username>/<repo_name>.git

将账号密码写入到请求地址当中 比如我账户为: gaopengfei 密码为: 123456 请求的库的地址是 https://github.com/gaopengfei123123/redis_lbs.git 那么我的远程地址就是

1
git remote set-url origin https://gaopengfei:123456@github.com/gaopengfei123123/redis_lbs.git

参考issues