ubuntu 使用github

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36251958/article/details/87889011

ubuntu默认安装 git 无须手动安装

第一:配置全局账号及邮箱信息

git config --global user.name "Your name" //用户名
git config --global user.email "your [email protected]"  //邮箱信息

第二:生成ssh秘钥

ssh-keygen -t rsa -C "GitHub的邮箱地址"

之后一直回车

查看秘钥内容 ,并复制到github上

cat ~/.ssh/id_rsa.pub

点击 github 用户头像-settings- ssh gpg

将秘钥内容 复制进去
检测是否成功

ssh -T [email protected]

出现 :

Hi wangye8899! You've successfully authenticated, but GitHub does not provide shell access.

即为成功

第三 : 在github上创建仓库

在本地新建文件夹 ,cd进入文件夹并输入

git init 

初始化

sudo vim test.txt 编写测试文件 内容随意

命令行 输入

git add ./

将本地文件提交至本地缓存区

命令行输入

git commit -m "第一次提交测试"

将缓存区文件提交至 github本地仓库

命令行输入

git remote add origin [email protected]:wangye8899/graduation-project.git

git remote add origin 远程仓库地址 远程仓库地址在官网的Clone or download

origin 为远程仓库名 任意

命令行输入

git push origin master 

将github仓库文件 提交至github服务器 存储

参考链接:

https://blog.csdn.net/Chenftli/article/details/81141010

猜你喜欢

转载自blog.csdn.net/qq_36251958/article/details/87889011