在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》一文
本文详细介绍了如何在GitHub上创建并推送项目,包括通过HTTPS和SSH两种方式的操作步骤。HTTPS方式便于初次使用,但每次推送需输入密码;SSH方式虽然初次设置稍显复杂,但后续操作更为便捷。
3179

被折叠的 条评论
为什么被折叠?



