Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将本地文件推送到github repo中的目录_Git_Github - Fatal编程技术网

将本地文件推送到github repo中的目录

将本地文件推送到github repo中的目录,git,github,Git,Github,我在本地repo中有一个文件,我想将其推送到Github repo中的一个目录 我有以下文件: F:\Development\Python\Workspace\StringCalculator.py 我需要将此文件推送到我的回购协议的以下路径: https://github.com/Gouravchawla/PyCodeFiesta/tree/master/GUI 如何将文件推送到该位置?我在Git Shell中尝试了以下命令: $ git remote add newremote http

我在本地repo中有一个文件,我想将其推送到Github repo中的一个目录

我有以下文件:

F:\Development\Python\Workspace\StringCalculator.py
我需要将此文件推送到我的回购协议的以下路径:

https://github.com/Gouravchawla/PyCodeFiesta/tree/master/GUI
如何将文件推送到该位置?我在Git Shell中尝试了以下命令:

$ git remote add newremote https://github.com/Gouravchawla/PyCodeFiesta/tree/master/GUI
$ git push newremote master
当我执行上述命令时,我得到以下错误:

fatal: repository 'https://github.com/Gouravchawla/PyCodeFiesta/tree/master/GUI/' not found

我非常感谢您在这方面提供的任何帮助和见解。

您不能将单个文件推送到远程存储库中的目录。Git使用完整目录快照,您只能推送提交(历史记录)

因此,要将文件放入存储库,必须创建一个包含该文件的提交:

git clone https://github.com/Gouravchawla/PyCodeFiesta
cd PyCodeFiesta
cp 'F:\Development\Python\Workspace\StringCalculator.py' GUI/
git add GUI/StringCalculator.py
git commit -m 'Added StringCalculator file'
git push origin master:master