概述
idea现有项目需要上传指定的gitee地址,该如何处理,出现以下错fatal: remote origin already exists,该如何解决
使用
一般在
gitee
上创建一个项目,再将本地项目上传,.gitignore
文件不要忘记
实际场景 如下
在
idea
中即可执行以下命令
appledeMacBook-Pro:spark-demo hyl$ git remote add origin git@gitee.com:long-train/spark-demo.git
fatal: remote origin already exists.
appledeMacBook-Pro:spark-demo hyl$ git remote rm origin
appledeMacBook-Pro:spark-demo hyl$ git remote add origin git@gitee.com:long-train/spark-demo.git
appledeMacBook-Pro:spark-demo hyl$ git add .
appledeMacBook-Pro:spark-demo hyl$ git commit -m "init"
[master 66dcc3b] init
1 file changed, 23 insertions(+)
create mode 100644 .gitignore
appledeMacBook-Pro:spark-demo hyl$ git push -u origin "master"
Enumerating objects: 44, done.
Counting objects: 100% (44/44), done.
Delta compression using up to 8 threads
Compressing objects: 100% (34/34), done.
Writing objects: 100% (44/44), 11.94 KiB | 2.98 MiB/s, done.
Total 44 (delta 2), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.4]
To gitee.com:long-train/spark-demo.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
appledeMacBook-Pro:spark-demo hyl$
结束
fatal: remote origin already exists. origin已存在,那么删除再重新操作一次
git remote rm origin