将本地存储库与远程存储库连接

人气:595 发布:2022-10-16 标签: git repository

问题描述

我有一个本地存储库。我创建了整个应用程序,但现在我想将其推送到远程存储库。我也已经有了远程回购。如何才能在不丢失任何工作的情况下连接这两个存储库?

推荐答案

使用:

git remote add origin <remote_repo_URL>
git push --all origin

如果要将所有分支设置为在使用git pull时自动使用此远程存储库,请将--set-upstream添加到推送:

git push --all --set-upstream origin

334