1) 检查 repository 所用的连接 REMOTE URL
$ git remote -v
origin git@github.com:user/repo.git (fetch)
origin git@github.com:user/repo.git (push)
# 重新配置 REMOTE URL (从 SSH 改为 HTTPS)
$ git remote set-url origin https://github.com/user/repo
2) 配置
------ Linux ------
$ git config credential.helper store
------ Mac ------
$ git config --global credential.helper osxkeychain
------ Windows ------
$ git config --global credential.helper manager
3) 测试: 修改文件后, push 上载
$ git add <filename> / git rm <filename>
$ git commit -m "<title>"
# 第一次输入要 email 户口 和密码, 以后即便重启也不需再输入密码了
$ git push https://github.com/user/repo
4) 检查
会生成 2 个文件
$ cat ~/.gitconfig
[user]
email = uid@email.com
name = Jason Mun
[credential]
helper = store
$ cat ~/.git-credentials
https://<uid>%40<email.com>:<password>%23@github.com
%40: @
%23: #
没有评论:
发表评论