Ubuntu 使用GIt

1 安装

源设置如下图:

Ubuntu 使用GIt
Ubuntu 使用GIt
Ubuntu 使用GIt
之后执行代码

sudo apt-get update
sudo apt-get install git

输入

git

显示如下表示正确
Ubuntu 使用GIt

2设置Git

  1. 设置用户名和邮箱
git config --global user.name "xxx"
git config --global user.email "[email protected]"

之后在~/.gitconfig 文件中可以看到你设置的信息

  1. 产生SSH钥匙
ssh-****** -C '[email protected]' -t rsa #创建SSH
cd  ~/.ssh
gedit id_rsa.pub #查看SSH`在这里插入代码片`

复制内容到github设置中的SSH,添加SSH
Ubuntu 使用GIt
测试链接:

ssh -T [email protected]
  1. 关联远程仓库
git clone https://XXX

进入到仓库的文件夹里面

git remote add origin "https://github.com/simonlee327/Paperlearning.git"

不用每次push都输入密码,用下面的命令:

git config --global credential.helper store

之后有了本地仓库的更改执行下列步骤提交:

git add -A
git commit -a -m "S"
git pull origin master
git push origin master