第一步:
生成密钥 ssh-keygen -t rsa -C "你的github邮箱"
之后一直点确定(enter键)
在home目录下按ctrl+h可以显示隐藏文件夹,其中有隐藏文件夹.ssh,点进去,有个id_rsa.pub文件,打开复制里面的key
第二步:
到你的github网站上去,头像下进入Settings,左边选择SSH and GPG keys,新建一个SSH key,title随便,粘贴上一步的key
第三步:
在命令端输入ssh -T git@github.com
看到如下信息,则是成功连上github
Hi ******! You've successfully authenticated, but GitHub does not provide shell access.
第四步:
编辑你的.gitconfig文件,用下面命令即可
git config --global user.name "github姓名"
git config --global user.email github邮箱
××××××××××××××××××××××××××××××××××××××××××××
上面是电脑git和ssh的基本配置,默认git和ssh已安装完全
××××××××××××××××××××××××××××××××××××××××××××
第五步:
(如果要上传单一文件,方法一:初始化之后依次执行(或者删除.git文件之后初始化)...方法二待定)
cd 到你的一个测试上传文件去
git init
git remote add origin (github地址,网站上有)如:git@github.com:××××××/×××××××.git
删除远程:git remote rm origin
这里的上传的远程仓库要自己建立,在github网站上,头像下your repositories,右上角新建NEW即可,里面有个ssh,后有地址
第六步:
git add README.md或者add (要上传的文件)
git commit -m "first commit(第几次提交,自己修改)"
git push -u origin master
大文件不能上传(小于等于100M),是其他方法,暂且不表