提交代码到github

1. 下载git

点击download下载即可。下载地址:https://gitforwindows.org/

2. 注册github

github地址:https://github.com/

一定要记得注册的用户名,邮箱和密码。以后登录github,以及提交代码都会用到。

3. 初始化本地git仓库

新建一个目录(名字自己随便取)-------》进入目录-------》鼠标右键-------》在出现的菜单中,选择 Git Bash Here -------》进入git命令界面-------》执行git init命令

4. 创建文件,提交到本地仓库

cuishuai01@SXS-A333-D MINGW64 /e/githubcode/oodb (master)
$ touch README                      #创建文件

cuishuai01@SXS-A333-D MINGW64 /e/githubcode/oodb (master)
$ git add README                      #把文件添加到本地

cuishuai01@SXS-A333-D MINGW64 /e/githubcode/oodb (master)
$ git commit -m "first commit"                  #提交到本地仓库
[master (root-commit) d89af61] first commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README

cuishuai01@SXS-A333-D MINGW64 /e/githubcode/oodb (master)
$ git push -u origin master                    #push到远程分支
fatal: HttpRequestException encountered.
An error occurred while sending the request.
Username for 'https://github.com': cs-Hacker            #在这里要输入用户名(当时注册github的时候的用户名),输入之后按下回车,会提示输入密码,输入密码正确之后,就会push到远程的github分支了
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (6/6), 465 bytes | 465.00 KiB/s, done.
Total 6 (delta 0), reused 0 (delta 0)
To https://github.com/cs-Hacker/oodb.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

原文地址:https://www.cnblogs.com/CUI-S/p/9484153.html