github使用教程

这篇教程主要讲如何使用GitHub的命令上传代码以及更新代码,默认电脑已经安装了git软件

一、创建仓库

1、点击new repository,创建仓库

填写相关信息

 创建完成后会显示这些命令

 2、进入要上传的文件夹,右键选择git bash here

 3、一次输入这些代码

 1 # 初始化
 2 git init
 3 
 4 # 添加当前目录下的所有文件到仓库
 5 git add .
 6 
 7 # 本次上传的备注说明
 8 git commit -m "fisrt commit"
 9 
10 # 将本地仓库关联到你的 git 地址 gituser/project 改为你自己的信息
11 git remote add origin https://github.com/gituser/project.git
12 
13 # 拉取内容
14 git pull origin master
15 
16 # 上传代码到 github
17 git push -u origin master
View Code

这样就上传成功了

二、上传更新代码

如果代码更新了,需要再次上传,使用 下面代码

 1 # 将所有内容添加到仓库
 2 git add *
 3 
 4 # 更新说明
 5 git commit -m "测试更新"
 6 
 7 # 拉取内容
 8 git pull
 9 
10 # 上传
11 git push origin master
View Code

这样就完成了代码的更新。

原文地址:https://www.cnblogs.com/hequnwang/p/14273277.html