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

fatal: remote origin already exists. , fatal: No such 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'.

怎么可能?

这是可能的,因为 git remote remove 查找远程别名 name 而不是 实际的 URL。

git remote remove origin

那会奏效。

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

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

您可以尝试以下 git 命令:

在 git 初始化之后,您可以添加 repo,然后尝试通过以下命令从 git 站点设置 url

git remote set-url origin

设置原点后尝试您的回购 url

git remote set-url origin [https: your repo link from git]

检查你设置的url是否在master里面

git remote -v

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

git push -u origin master

有时 set-url 在 add 不工作时工作,所以试试上面的命令。