如何将克隆的git存储库上传到github上自己的git存储库?

Mla*_*den 6 git clone push github repository

我从 github 克隆了一个项目。现在我想将其上传到 github 上我自己的私人存储库以进行处理。但是克隆的存储库在原始键中具有克隆项目的值。将此项目上传到我自己的私人存储库的最佳实践是什么?我已经阅读了 git 文档的德语版本(https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes),但尚未找到解决方案。

小智 5

您可以按照以下步骤操作

git remote -v
git remote remove origin
git remote -v   //to check if it was remove
Run Code Online (Sandbox Code Playgroud)

转到 Github,创建一个新存储库。

git remote add origin <the new repository>
git remote -v
Run Code Online (Sandbox Code Playgroud)


phd*_*phd 2

通过命令

git remote add newrepo NewRepoURL
Run Code Online (Sandbox Code Playgroud)

您将有一个额外的远程称为newrepo(您可以将其命名为任何您想要的方式)指向 NewRepoURL。要推送(而不是上传),您需要分支到新的远程执行

git push newrepo master
Run Code Online (Sandbox Code Playgroud)