java本地写好的代码如何提交到GitHub上?

如:本地有自己写好的项目,我需要提交到GitHub上,如何实现?
1.选中项目所在地,鼠标右键Git Bash Here,git init

java本地写好的代码如何提交到GitHub上?
2.关联到远程仓库,git remote add origin GitHub_Repositories_Url(远程仓库的地址)

java本地写好的代码如何提交到GitHub上?

3.修改本地.git文件下的config文件,添加[branch "master"] remote = origin merge = refs/heads/master

java本地写好的代码如何提交到GitHub上?

4.提交代码git add .
5.git commit -m 'first commit'

6.git push