新项目push/pull到github

1、在github上新建一个git仓库

 

 

 2、本地新建一个项目文件夹,新建一个hello.txt文件

 

 

 3、在新建的目录下打开git bash ,将此目录初始化为git本地仓库,目录下会自动生产.git文件

git init

 

 

 4、将hello.txt文件add到暂存区,并查看状态

git add hello.txt
git status

 

 

 5、将hello.txt文件commit到本地仓库,并且查看状态

git commit hello.txt -m 将暂存区文件提交到本地仓
git status

 

 

 6、添加远程仓库(远程仓地址为github 克隆地址,如果报错说已经存在了,删除重建)

git remote add origin https://github.com/BoommShakaLaka/test.git
fatal: remote origin already exists.
先输入 git remote rm origin
再输入 git remote add origin http://github.com/BoommShakaLaka/test.git

 

 

 

 

 

 

 

 

 

 7、推送本地文件至github(远程仓库),查看github 是否提交hello.txt文件 (第一次推送会提示输入账户密码)

$ git push -u origin master

 

 

 

posted @ 2020-08-30 21:54  人间草木~  阅读(376)  评论(0编辑  收藏  举报