如何使用云 9 更改 git 存储库

How to change git repository using cloud 9

我使用以下命令克隆了一个 github 存储库

git config --global user.name "x"
git config --global user.email x
git init
git add -A
git commit -m "message"
git remote add origin /link/
git push -u origin master

现在我在工作区中,想将工作区连接到不同的 GitHub 存储库。怎么做?

感谢您的宝贵时间

If you have already connected to a github reop

,您需要先删除遥控器

删除遥控器 使用 git 远程 rm 命令从您的存储库中删除远程 URL。

git 远程 rm 命令有一个参数: 远程名称,例如,destination:

$git remote -v
# View current remotes
origin  https://github.com/OWNER/REPOSITORY.git (fetch)
origin  https://github.com/OWNER/REPOSITORY.git (push)
destination  https://github.com/FORKER/REPOSITORY.git (fetch)
destination  https://github.com/FORKER/REPOSITORY.git (push)
$git remote rm destination
# Remove remote
$git remote -v
# Verify it's gone
origin  https://github.com/OWNER/REPOSITORY.git (fetch)
origin  https://github.com/OWNER/REPOSITORY.git (push)

注意: git remote rm 不会从服务器上删除远程仓库。它只是从您的本地存储库中删除遥控器及其引用。

其次,我git初始化新的存储库。

希望对您有所帮助