步骤
0、注册github帐号,新建仓库。
1、sudo apt-get install git
2、ssh-keygen -t rsa -C “用户名”
注意这里是用户名,有的教程说的是邮箱,后面实践发现需要写用户名。
3、在~/.sshs下找到id_rsa.pub,将gedit id_rsa.pub
中的全部内容复制到github的profile中的SSH里。然后测试sshssh -T git@github.com
。1)这里会提示一个yes/no,需要选择yes;2)再次测试,遇到sign_and_send_pubkey: signing failed: agent refused operation,通过以下方法解决:
eval "$(ssh-agent -s)"
ssh-add
再次测试
这样是正常的。
4、配置用户名和密码
git config –global user.name “your name”
git config –global user.email “your email”
如果需要重新修改,可以使用如下方式
git config --global --replace-all user.email "your@email.com"
5、
进入需要长传代码的文件夹,创建一个空白仓库git init
;
关联git remote add origin git@github.com:yourName/yourRepo.git
;
添加文件进缓冲区git add xxx
或git add .
;
将缓冲区的文件添加到本地仓库分支git commit -m ‘这里是注释’
-m表示注释;
最后提交git push origin master
参考
1、https://blog.csdn.net/szj_huhu/article/details/77541345
2、https://blog.csdn.net/huangxinglian/article/details/90694361?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.control
3、https://blog.csdn.net/weixin_39863895/article/details/103960384?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control
4、https://blog.csdn.net/cheneykl/article/details/80769747