1 注册Github
注册完成之后会需要验证邮箱才能正常使用GitHub。
注册完成后,创建一个属于自己的库,包括库的名字,以及对库的介绍。
2 安装Git
首先进入Git官网下载适合自己电脑的版本,执行默认安装选项。
3 配置密钥
在本地创建ssh key并填写到Github网站,实现本地git与Github的认证连接。
执行以下命令。邮箱为注册Github的邮箱,注意输入对应密码,其他选项可默认。
ssh-keygen -t rsa -C “your_email@youremail.com“
在*c:/user/用户名/.ssh**这个文件夹下找到id_rsa.pub***文件复制密钥内容。
登录Github,在Setting—SSH and GPG Keys页面下点击New SSH Key按钮,取名并粘贴密钥内容,保存。
执行命令,绑定用户信息.
ssh -T git@github.com
git config –global user.name “github-username”
git config –global user.email “you-email”
4 测试Git与Github连接
依次执行命令:
定位D盘根目录
cd /D
创建文件夹
mkdir testProject
cd testProject克隆代码库,增加代码并提交
git clone https://github.com/username/test.git
cd test
echo “No Content” > test.cpp
git add test.cpp
git commit -m “test commit”
git push origin master提交完毕后,打开Github网站,查看Test项目是否增加代码文件test.cpp