一、安装git工具
sudo apt-get install git
二、配置git
1、设置ssh密钥
ssh-keygen -t rsa -C "github邮箱" Generating public/private rsa key pair. Enter file in which to save the key (/home/xxx/.ssh/id_rsa): Created directory '/home/xxx/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/xxx/.ssh/id_rsa Your public key has been saved in /home/xxx/.ssh/id_rsa.pub The key fingerprint is: SHA256:ckBJoq6qi4croYkik+T//wuYLVlurXiairNS1dWzc1E liutt1312@126.com The key's randomart image is: +---[RSA 3072]----+ | ..o. . .E | | . o. . o . | | . ... o . | | . . .. o . | | .. ..S o | |.o. Bo. | |** = = . | |#oo =.o | |%B+oo=+o.o. | +----[SHA256]-----+
2、将.ssh/id_rsa.pub 文件内容拷贝,添加至github
头像->settings->SSH and GPG keys ->new SSH key
3、配置github用户名和邮箱
git config --global user.name "用户名" git config --global user.email 邮箱
三、配置本地项目(工程)
1、初始化 git init 2、在github创建仓库,添加远程访问 git remote add origin git@github.com:github用户名/test.git git remote set-url origin git@github.com:github用户名/test.git 3、提交文件至本地暂存区 git add filename (git add ./) 4、提交暂存区文件至本地仓库 git commit -m "init" 5、上传本地仓库 git push -u origin master



