开发者

what is the best way to change a Git repo's origin?

开发者 https://www.devze.com 2023-04-11 12:33 出处:网络
I cloned a read-only Git repo from GitHub onto my server.The next day, I forked that repo on GitHub.What are the steps to update the remotes on my repository and make sure everything on the server is

I cloned a read-only Git repo from GitHub onto my server. The next day, I forked that repo on GitHub. What are the steps to update the remotes on my repository and make sure everything on the server is up-to-date?开发者_StackOverflow社区

Is this the way to start? Is there anything else I need to to so that the clone will treat the new origin as if I had originally cloned from it?

git remote rename origin upstream
git remote add origin git@github.com:user/fork.git


Use the commands in your own post, then point the master branch to your new remote (as it has been automatically changed to upstream):

git config branch.master.remote origin

Another way:

git push -u origin master
0

精彩评论

暂无评论...
验证码 换一张
取 消