Git创建本地仓库并推送至远程仓库

1、创建本地仓库

$ git init    # 初始化一个git仓库,增加.git目录

2、把文件添加到暂存区

$ git add file
$ git add dir/*
$ git status # 查看文件状态

3、若误提交,删除暂存区文件

$ git rm --cache file

4、将暂存区文件提交到工作区

$ git commit -m "注释"

5、添加远程仓库(远程仓库需要先创建)

$ git remote add origin https://9.110.187.100/test/scripts.git    # 远程仓库地址 将当前仓库与远程仓库关联,且远程仓库alias为origin
$ git remote # 查看本地仓库关联的远程仓库

6、将本项目推送到远程仓库

$ git push origin https://9.110.187.100/test/scripts.git
或
$ git push --set-upstream origin master

7、拉取远程仓库

$ git clone https://9.110.187.100/test/scripts.git
posted @ 2020-03-20 02:50  一毛丶丶  阅读(869)  评论(0编辑  收藏  举报