你可以使用git将dist文件从本地非github目录推入github存储库的某个目录吗?

时间:2015-02-06 17:14:44

标签: git github

例如:

我想把本地dist文件夹('built'app文件)和push文件带到我的一个github存储库中的文件夹中。即。 github.com/myacct/repositoryA/app

我当时想做点什么

cd path/to/my/local/localdevproject/dist    // not git repo
git init
git push origin https://github.com/myacct/repoA.git/app

我尝试了它并且错误地指出refspec错误。试图从git中读取文档并且它们令人困惑。

1 个答案:

答案 0 :(得分:1)

您可以将工作树暂时设置为另一个文件夹(包括您的dist文件夹)

cd /local/path/of/your/repository/clone
git --work-tree=/path/to/parent/of/dist add dist
git mv dist folder1
git commit -m "Add dist to folder1"
git push

该解决方案中的主要命令是git --work-tree,它允许更改工作树路径(同时,在此处,将git-dir保持为当前仓库)。 请参阅man git page