将本地文件推送到github repo中的目录
我的本地存储库中有一个文件,我想将其推送到我的Github存储库中的目录.
I have a file in my local repo that I want to push to a directory in my Github repo.
我有以下文件:
F:\Development\Python\Workspace\StringCalculator.py
我需要将此文件推送到我的仓库的以下路径:
I need to push this file to the following path of my repo:
https://github.com/Gouravchawla/PyCodeFiesta/tree/master/GUI
如何将文件推送到该位置?我已经在Git Shell中尝试了以下命令:
How do I push the file to this location? I have tried the following commands in Git Shell:
$ git remote add newremote https://github.com/Gouravchawla/PyCodeFiesta/tree/master/GUI
$ git push newremote master
执行上述命令时,出现以下错误:
When I execute the above commands I get the following error:
fatal: repository 'https://github.com/Gouravchawla/PyCodeFiesta/tree/master/GUI/' not found
在此问题上,我将不胜感激.
I would really appreciate any kind of help and insight in this matter.
您不能将单个文件推送到远程存储库中的目录.Git使用完整目录快照,您只能推送提交(历史记录).
You cannot push single files to directories inside remote repositories. Git works with full directory snapshots and you can only push commits (history).
因此,要将文件放入存储库,必须创建一个包含该文件的提交:
So, to get your file into your repository, you have to create a commit containing the file:
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