从现有存储库中创建一个新的存储库及其所有代码?

时间:2014-06-02 16:09:48

标签: git github

我最近开始使用git。我正在尝试非常简单的事情,我不知道该怎么做。

我有一个像这样的存储库 -

Testing/ABC

在上面的存储库中,我有一些项目。现在我正在尝试克隆此存储库并创建一个新的存储库 -

Testing/PQR

意思是,无论ABC存储库内部是什么,它都应该自动进入PQR存储库,然后我可以将此存储库推送到github。

这可能吗?

1 个答案:

答案 0 :(得分:3)

假设您已经在名为PQR的github上创建了一个新的空存储库,您可以按照以下步骤操作:

# clone original repo
git clone git@github.com:yourcompany/ABC.git PQR

# Set origin to the new repo
cd PQR
git remote remove origin
git remote add origin git@github.com:yourcompany/PQR.git

# Now push all the branches and tags to the new repo
git push --all
git push --tags
相关问题