我从github上克隆了一个项目。现在我想将它上传到我的私有仓库中以便于进行工作。但是,克隆的仓库在origin键中具有克隆项目的值。上传这个项目到我的私有仓库的最佳实践是什么?我已经阅读了git文档的德语版本(https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes),但没有找到解决方案。
git remote -v
git remote remove origin
git remote -v //to check if it was remove
git remote add origin <the new repository>
git remote -v
使用该命令
git remote add newrepo NewRepoURL
newrepo
的额外远程仓库(你可以根据自己的喜好进行命名),该仓库指向NewRepoURL。要将你的分支推送到新的远程仓库(而不是上传),请执行以下操作:git push newrepo master
$ git push myrep master To https://github.com/xxxx/myrep.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/xxx/myrep.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.
- Mladen