git - 尝试将我的 VS Code 与不同的 GitHub 存储库链接
问题描述
我的一个朋友用我的 GitHub 帐户设置了我的 Visual Studio 代码,效果很好。我现在想移动到 GitHub 上的新存储库,但仍将其与我的 VS Code 链接,但我的问题是,当我对新项目进行测试推送时,它仍在将我的更改推送到我不这样做的 Git 上的存储库不想让它走?请有人可以帮我解决这个问题。注意,我没有安装 Git,我只是使用 GitHub 的 UI。我希望我的 VS 代码与https://github.com/KaysHaydock/Kay-Hangman-Game.git而不是我不想接触的回购链接:https ://github.com/KaysHaydock/SOFT355 -HangMan.git
我现在担心我可能弄乱了我的 VSCode 和 KaysHaydock/SOFT355-HangMan.git 之间的链接 - 是否有任何命令可以用来检查哪个项目与哪个 github 链接?
终端:
Kayleighs-MacBook-Pro:SOFT355-HangMan-ATTEMPT-LIVE Kayleigh$ git remote add origin https://github.com/KaysHaydock/Kay-Hangman-Game.git
fatal: remote origin already exists.
Kayleighs-MacBook-Pro:SOFT355-HangMan-ATTEMPT-LIVE Kayleigh$ git push -u origin master
Counting objects: 2, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 276 bytes | 276.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/KaysHaydock/SOFT355-HangMan.git
cec379f..6d9e280 master -> master
Branch master set up to track remote branch master from origin.
解决方案
输出显示origin
远程当前指向旧的 GitHub 存储库。您可以更新远程的 URL 或创建一个新的远程。
更改origin
远程的 URL:
采用:
$ git remote set-url origin <path-to-new-repository>
然后,推
$ git push origin master
创建一个新的遥控器:
要创建一个名为 say 的新遥控器newremote
,请使用:
$ git remote add newremote <path-to-new-repository>
然后,推动:
$ git push newremote master
推荐阅读
- ldap - 按 OU 限制 LDAP 用户
- meteor - 流星创建抛出错误:module.js:549 无法为测试包安装 npm 依赖项
- reactjs - 通用包装 React 组件
- autodesk-forge - 从单个 .zip 触发多个翻译
- android - Dagger 2,在模块中提供应用程序上下文
- angular - 角分离侧边栏
- spring-mvc - 如何在spring java配置中全局设置sessin超时
- python - 如何解决 TesseractNotFoundError?
- google-cloud-platform - 如何使用 gcloud 创建云启动器产品集群
- r - Quantstrat 交易策略初始股权考虑