github配置
-
检查ubuntu主目录下.ssh文件夹
提示: 按
ctrl + h
打开隐藏文件如果没有发现以下两个文件
那么,打开终端cd到.ssh文件目录下,运行以下命令:ssh-keygen -t rsa -C "youremail@email.com"
此处邮箱账号为你的github注册邮箱。运行命令后所有选项选择默认,直接回车即可。
-
将id_rsa.pub添加到github 注意:一定是id_rsa.pub文件,也就是上图第二个文件
使用gedit文本编辑器打开id_rsa.pub,全选复制。
进入到你的github,打开settings,并进入以下界面。
将id_rsa.pub文件内容粘贴到key下方蓝色框。title为自定义。
3.依次运行以下命令即可将文件上传到github(此方法需要在网页版先创建仓库)
git config --global user.name "YourGithubName"
git config --global email.name "youremail"
git init
git add ./thefile
git commit -m "your commit"
git remote rm origin
git remote add origin https://github.com/yourgithub/yourepository.git
git push -u origin master