1.参考链接:https://blog.csdn.net/tina_ttl/article/details/51326684
http://www.runoob.com/w3cnote/git-guide.html
开始使用github
1. 配置git
git config --global user.name "你的github用户名"
git config --global user.email "你的github邮箱地址"
然后 Shell执行
cd ~/.ssh
ssh-keygen -t rsa -C "你自己的github对应的邮箱地址"
将刚刚创建的ssh keys添加到github中
(1)利用gedit/cat命令,查看并复制id_rsa.pub所有的内容
(2)在GitHub中,依次点击Settings -> SSH Keys -> Add SSH Key,将id_rsa.pub文件中的字符串复制进去,注意字符串中没有换行和空格,保存。
输入如下命令:
ssh -T [email protected]
如果看到如下所示,则表示添加成功:
You’ve successfully authenticated, but GitHub does not provide shell access.
2. 新建本地文件夹(仓库)
本地仓库初始化
cd ~/Document/newflode
git init
touch Readme.me
3. 在Github.com新建一个仓库(repository),例如:
https://github.com/XiaoGongWei/Ubuntu16.04-Code.git
进入要上传的仓库,右键git bash,添加远程地址:
注:https://github.com/你的github用户名/你的github仓库.git 是github上仓库的网址
4. 将文件增加到本地缓存 index
git add Readme.me
(git add <filename> 或 git add *)
git commit -m 'add readme file'
5. push 推送本地仓库到网络
你的改动现在已经在本地仓库的 HEAD 中了。执行如下命令以将这些改动提交到远端仓库:
git push origin master
可以把 master 换成你想要推送的任何分支。
6. 提交更改
返回到根目录下面
git add *
git commit -m 'add some files'
git push origin master
无密码登录:
vim .git-credentials
https://{username}:{password}@github.com
进入git bash终端, 输入如下命令:
git config --global credential.helper store
执行完后查看%HOME%目录下的.gitconfig文件,会多了一项:
[credential]
helper = store
重新开启git bash会发现git push时不用再输入用户名和密码
7. 更多内容请看下面链接
无密码登录:http://www.cnblogs.com/ballwql/p/3462104.html
http://www.runoob.com/w3cnote/git-guide.html