使用Git/Github for Windows,如果我有一个存储库的这个目录:C:\dir1\dir2,我需要做什么来移动回购文件到C:\dir1?显然,我可以物理地复制和粘贴文件,但在Git端需要做什么呢?
我在GitHub上有这个回购,我使用Git Bash和GitHub for Windows。
使用Git/Github for Windows,如果我有一个存储库的这个目录:C:\dir1\dir2,我需要做什么来移动回购文件到C:\dir1?显然,我可以物理地复制和粘贴文件,但在Git端需要做什么呢?
我在GitHub上有这个回购,我使用Git Bash和GitHub for Windows。
当前回答
只需复制整个工作目录的内容(包括隐藏的.git目录)。这将把整个工作目录移动到新目录,并且不会影响GitHub上的远程存储库。
如果你正在使用GitHub for Windows,你可以使用上面的方法移动存储库。但是,当您单击应用程序中的存储库时,将无法找到它。要解决这个问题,只需单击带!的蓝色圆圈,选择Find It,然后浏览到新目录。
其他回答
我使用Visual Studio git插件,我有一些网站运行在IIS上,我想移动。一个简单的方法对我很有效:
关闭Visual Studio。 移动代码(包括git文件夹等) 单击新位置的解决方案文件
这将使用已移动的现有本地git文件刷新到新位置的映射。当我回到Visual Studio时,我的团队资源管理器窗口显示了新位置的回购。
I use Github Desktop for Windows and I wanted to move location of a repository. No problem if you move your directory and choose the new location in the software. But if you set a bad directory, you get a fatal error and no second chance to make a relocation to the good one. So to repair that. You must copy project files in the bad directory, make its reconize by Github Desktop, after that, you can move again your project in another folder and make a relocate in the software. No need to close Github Desktop for that, it will check folders in live.
希望这能帮助到一些人。
如果你使用Visual Studio,使用Teams Explorer > Connect选项卡> Local Git Repositories中的Add来将现有的本地回购带到可用的回购中。不吵闹,不麻烦。
将本地存储库链接到不同的远程存储库
删除与远程存储库的所有连接: 在项目文件夹内:
删除本地存储库中的所有数据 git状态(我必须说它没有链接到任何)
链接到一个新的远程存储库
git init启动本地存储库 Git远程添加原始urlrepository。链接到远程存储库 git remote -v确认它链接到远程存储库
3-向本地存储库添加更改并推送
Git pull或Git pull origin master——allow-unrelated-histories(如果本地和远程repo中的Git历史不同)。 git添加。 git commit -m" Message " Git push -u origin master
-首先检查当前文件夹中包含git repo的所有目录 $ ls -la或者ls -al
-识别这个文件夹
**.git**
-使用此命令移动文件夹到您需要的位置,
$ mv .git你想要的目录
注意:>目录不会影响git的历史记录,也不会影响远程连接 考虑要移动到的目录的树(路径)