如何删除 git 远程源并添加新的远程源?

How to remove the git remote origin and add new remote origin?

我已经从另一个人的一个 git 存储库中克隆了代码,现在我想将代码提交到我的 git 存储库中。我如何在不复制粘贴 post-checkout 的情况下做到这一点?

任何 git 参考资料都会更有帮助。

运行 依次执行以下命令:

  • git remote

Will get the current remote path

  • git remote remove <remote path>

So now your remote link will be deleted, now you can add your repo and commit your changes, anyway confirm whether the remote has been deleted using below command

  • git remote

Nothing should be displayed

  • git remote add origin <your git repo http path>

Now your repo will be added as git repo to this folder, so now push your code changes to the new repo using below command.

  • git push origin master