一、安装及配置
1、Ctrl+Alt+T打开命令行键入安装命令
sudo apt-get install git
2、配置github账号信息
git config --global user.name "ZHAOMANGANG"
git config --global user.email "zhaomangang@qq.com"
引号内写你自己的github用户名和注册github的邮箱
3.设置让credential helper 帮助我们在一定时间内在内存中保存我们的code,其中第二行为设置超时的时间
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'
二、创建仓库及从本地提交代码
1、创建仓库
在网页上登陆github
2、本地建立一个文件夹
mkdir demo
3、 初始化仓库
git init
4、创建描述文件
touch README
5、 提交刚刚加入的README文件
git add README
git commit -m "first commit" //-m 用于指定本次提交的描述信息
6、提交到仓库
git remote add origin https://github.com/zhaomangang/demo.git
后面的链接为你刚在网页版创库后生成的链接
git push -u origin master
接着根据提示输入密码即可