在同一个远程仓库,多次提交不同的文件

我在想能否在同一个仓库中,多次上传不同的文件,事实证明是可以的:
1.首先我在原来已经上传过文件的文件夹下,新创建了一个文件demoNew.txt
2.然后将该文件添加到本地git仓库

$git add demoNew.txt

3.第三步,提交到本地仓库:

$ git commit -m "This is a demo for test"

4.第四步,像以前一样连接到远程仓库demo

$ git remote add origin git@github.com:Glenmy11111/demo.git

5.出现之前说过的错误:

fatal: remote origin already exists.

像之前那样解决就好

$git  remote rm origin

6.上传到远程git仓库:

$ git push origin master

7.刷新远程github查看demo库,发现我们提交的文件已经传上去了。
这里写图片描述

猜你喜欢

转载自blog.csdn.net/Kratial/article/details/82226333