简体   繁体   English

更改Git仓库文件夹

[英]Change Git Repo Folder

I have created empty repo on github. 我在github上创建了空仓库。 On Our dev server, I have clone the repo on server root folder instead of public html folder. 在我们的开发服务器上,我已在服务器根文件夹而非公共html文件夹上克隆了存储库。

When I tried to push all my files on repository, I am getting all the server files and log as well for commit but I only want to push my public html folder files. 当我尝试将所有文​​件推送到存储库中时,我将同时获取所有服务器文件和日志以进行提交,但我只想推送我的公共html文件夹文件。

Here my question is: How can I change the repository folder to public_html ? 我的问题是:如何将存储库文件夹更改为public_html? Or as github repository is empty for now, How can I remove the github link from server root folder and link again to public_html folder. 还是因为github存储库暂时为空,我如何才能从服务器根文件夹中删除github链接并再次链接到public_html文件夹。

Thanks 谢谢

Probably the best best at this point would just be to go to wherever you have your git repo locally now and do a 此时最好的最佳方法可能是转到现在本地有git repo的任何地方,然后执行

(*nix)
rm -rf ./.git

(windows)
rd /s /q .\.git

That will remove the git repo from the directory. 这将从目录中删除git repo。 Then just go over into your public_html folder and reinitialize 然后只需进入您的public_html文件夹并重新初始化

cd public_html
git init
git remote add origin git@github.com:yourname/your-repo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM