我在 Eclipse 中有一个与 Gitlab 中的旧存储库相关联的项目。正在使用的分支称为测试。
我在 Gitlab 中创建了一个新存储库(其中只有 README.md 文件)。它只有一个分支:master。
我需要更改 Eclipse 项目,使其不再引用旧存储库(和旧分支),而是 - 引用新存储库(带有主分支)。
如何才能做到这一点?
TIA
更新
@Rizwan - 感谢您提供信息。我做了以下事情:
cd to the directory with the code
#initialize the repository
git init
#add reference to the repository I needed
git remote add origin "git@myrepo.com:WORK/<my-repository>.git"
#got what was currently in the repository
git pull origin master
#added code (not in the repository)
git add -A
#commit the code
git commit -m "first commit with code"
#sent it up
git push origin master
还有一条我用作基础的消息(但我现在找不到了)
TIA
最佳答案
这可能有帮助
cd /path/to/repo
git remote -v
git remote set-url origin gitlab@gitlab.mydomain:root/testproject.git
刷新/清理构建您的 Eclipse 项目
关于eclipse - 在 Eclipse java 项目中,将 git 存储库从旧的更改为新的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46266405/