Git 将所有内容推送到新的原点

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7630574/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 11:58:57  来源:igfitidea点击:

Git push everything to new origin

gitbranchcommit

提问by Kevin

I deleted my previous git origin, and created a new one. I did git add . and git commit. But it will update changes, how do i push everything into the new origin

我删除了我以前的 git 来源,并创建了一个新的来源。我做了 git add 。和 git 提交。但它会更新更改,我如何将所有内容推送到新的原点

采纳答案by Chris Kooken

git remote add origin <address>
git push origin <branchname>

回答by sdive

(works with git 1.8.4)

(适用于 git 1.8.4)

If you want to push all branchesat once:

如果你想一次推送所有分支

git push <URL> --all

To push all the tags:

推动所有标签

git push <URL> --tags

回答by Lem Lordje Ko

git push new_remote_name branch_name

git push new_remote_name 分支名称

回答by David Ward

Hmmmm I just did this. I am not sure if you did exactly the same but I had a different method.

嗯,我就是这样做的。我不确定你是否完全相同,但我有不同的方法。

I setup a bare repo on "newserver" (using ssh). Had the full clone of the repo on my laptop.

我在“newserver”上设置了一个裸仓库(使用 ssh)。在我的笔记本电脑上有完整的 repo 克隆。

I then did:

然后我做了:

git remote set-url origin "newservers url"
git push origin master