从别人的Github克隆回购,并将其推到我的Github上的回购 [英] Cloning a repo from someone else's Github and pushing it to a repo on my Github

查看:164
本文介绍了从别人的Github克隆回购,并将其推到我的Github上的回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 https://github.com/railstutorial/sample_app_rails_4 克隆了回购协议,并做了很多(我用它作为我自己的应用程序的起点),现在我想推出更改的应用程序到我自己的github帐户上的回购。

I cloned the repo at https://github.com/railstutorial/sample_app_rails_4 and made a lot of changes to it (I used it as a starting point for my own app), and now I would like to push the changed app to a repo on my own github account.

我怎样才能改变它连接的github repo?

How can I change what github repo it is linked to?

推荐答案

<正如Deefour所说,你的情况与在更改远程Git存储库的URI(URL)。当克隆存储库时,它将以名称添加为您的远程原点。你现在需要做的事情(因为你不再使用旧的源代码)是改变 origin 的网址:

As Deefour says, your situation isn't much unlike the one in Change the URI (URL) for a remote Git repository. When you clone a repository, it is added as a remote of yours, under the name origin. What you need to do now (as you're not using the old source anymore) is change origin's URL:

$ git remote set-url origin http://github.com/YOU/YOUR_REPO

如果原始存储库会经常更新,并且您希望不时更新这些更新,那么不要编辑 origin ,这将是最好的添加新的远程

If the original repository would update often and you want to get those updates from time to time, then instead of editing origin it would be best to add a new remote:

$ git remote add personal http://github.com/YOU/YOUR_REPO

或者甚至可以调用旧的上游

Or maybe even call the old one upstream:

$ git remote rename origin upstream
$ git remote add origin http://github.com/YOU/YOUR_REPO

然后,每当你想从上游,你可以这样做:

Then, whenever you want to get changes from upstream, you can do:

$ git fetch upstream

由于这个源代码是一个样本库(似乎是一种启动模板关闭),我不认为有必要保留它,也不要放弃它 - 我会在这里选择第一个选择。

As this the source is a sample repository (seems to be kind of a template to start off), I don't think there's a need to keep it nor fork it at all - I'll go with the first alternative here.

这篇关于从别人的Github克隆回购,并将其推到我的Github上的回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆