1、新建一个文件夹如:HelloDemo
2、文件夹下创建一个空白文档如:a.txt(我创建了个README.md添加不上,可能默认屏蔽了)
3、在文件夹内右键打开git命令窗口(Git Bash Here)
4、连接远程仓库:git remote add origin 仓库地址(例如:git remote add origin https://gitee.com/ling195/hello-demo.git)
5、添加本地空白文件:git add a.txt
6、提交本地空白文件:git commit -m 'first commit'
7、推送本地空白文件:git push origin master
8、仓库初始化成功,以下是命令场景
Administrator@WIN-LNFC7RH1QFU MINGW64 /e/AndroidStudioProjects/HelloDemo
$ git init
Initialized empty Git repository in E:/AndroidStudioProjects/HelloDemo/.git/
Administrator@WIN-LNFC7RH1QFU MINGW64 /e/AndroidStudioProjects/HelloDemo(master)
$ git remote add origin https://gitee.com/ling195/hello-demo.git
Administrator@WIN-LNFC7RH1QFU MINGW64 /e/AndroidStudioProjects/HelloDemo(master)
$ git add a.txt
Administrator@WIN-LNFC7RH1QFU MINGW64 /e/AndroidStudioProjects/HelloDemo(master)
$ git commit -m 'first commit'
[master (root-commit) b5d0dda] first commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a.txt
Administrator@WIN-LNFC7RH1QFU MINGW64 /e/AndroidStudioProjects/HelloDemo(master)
$ git push origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 206 bytes | 206.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-5.0]
To https://gitee.com/ling195/hello-demo.git
* [new branch] master -> master