ubuntu18.10配置git和github

(默认已有github账户)
第一步:安装git
  在终端输入:sudo apt-get install git

第二步:创建sshkey并添加到github账户

1. 创建sshkey:(注意此时最好在~/.ssh目录下操作,或者后面把key文件拷贝到此目录,否则后面会报错:permission denied(publickey)
首先在终端输入:ssh-keygen -t rsa -C "你注册github的邮箱", 按照提示输入文件名(一般命名为id_rsa),在当前目录下会生成id_rsa和id_rsa.pub两个文件
2.把密钥码添加到github账户(这样才能把你的机器和github账户联系起来):
在浏览器中登录github,在settings中找到SSH and GPG keys,选择“new sshkey”,把id_rsa.pub中的一长串码复制到对应位置,确定即可。

第三步:配置github账户(不然不能提交)
  git config --global user.name "你的github用户名"
  git config --global user.email "你的github注册邮箱"

OK,到此就配置完成了,可以尽情的pull,push,clone啦

猜你喜欢

转载自www.cnblogs.com/LuffysMan/p/9931533.html