您的位置:首页 > 编程语言

【GitHub】解决每次push代码到github都需要输入用户名和密码的方法

2013-10-09 13:12 609 查看
在github上,建立一个项目test,去主页查看可以看到

如果使用HTTPS:


Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/guochy2012/test.git git push -u origin master


Push an existing repository from the command line

git remote add origin https://github.com/guochy2012/test.git git push -u origin master


如果采用SSH:


Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:guochy2012/test.git
git push -u origin master


Push an existing repository from the command line

git remote add origin git@github.com:guochy2012/test.git
git push -u origin master


使用HTTPS需要每次输入密码,SSH则不用,但SSH需要配置密钥 。

关于怎么产生密钥可以参见《Generating
SSH Keys》一文
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git github