致命:远程来源已经存在。 ,致命:没有这样的远程:

时间:2019-07-13 09:32:35

标签: github git-push git-remote

我尝试了

git remote add origin https://github.com/rezaee/confusion-last.git

得到

fatal: remote origin already exists.

然后尝试

git push -u origin master

但得到:

warning: redirecting to https://github.com/rezaee/confusion.git/
To http://github.com/rezaee/confusion.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'http://github.com/rezaee/confusion.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

所以我尝试了

git remote remove https://github.com/rezaee/confusion-last.git

但是得到了

fatal: No such remote: 'https://github.com/rezaee/confusion-last.git'

怎么可能?

2 个答案:

答案 0 :(得分:1)

这是有可能的,因为git remote remove在寻找远程别名名称,而不是实际URL。

git remote remove origin

那会有用的。

但是,您的遥控器已经设置为另一个URL(see git remote -get-url origin)。
更改而无需删除它:

git remote set-url origin https://github.com/rezaee/confusion-last.git

答案 1 :(得分:0)

您可以尝试以下git命令:

git初始化后,您可以添加存储库,然后尝试通过以下命令从git站点设置网址

git远程设置URL来源

一旦设置了原点,请尝试输入您的回购网址

git远程设置URL的来源[https:您来自git的回购链接]

检查您设置的网址是否存在于主服务器中

git remote -v

现在您可以将您的存储库推送到github

git push -u原始母版

Sometimes set-url works when add don't. so try these above commands. hope it will help