将文件添加到GitHub存储库 [英] Adding files to a GitHub repository

查看:85
本文介绍了将文件添加到GitHub存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将文件添加到我的GitHub存储库?我使用的是Windows,并且我的所有项目文件都在一个文件夹中,而我只需要将它上传到我的回购站中即可。

总体思路是添加,提交并将文件推送到GitHub仓库。



首先,您需要克隆GitHub仓库。

然后,你会从你的其他文件夹添加所有文件:一个技巧是在git添加文件时指定一个备用工作树。

  git --work-tree = yourSrcFolder add。 

(从克隆的Git仓库的根目录完成,然后 git commit -ma msg git push origin master

,您可以将您的初始源文件夹从Git工作树中分离出来。






请注意,自2012年12月初以来,您可以直接从GitHub创建 新文件




ProTip™:您可以使用URL预填充文件名字段。

输入?filename = yournewfile.txt 在URL的末尾将预先填充名称 yournewfile.txt 的文件名字段。


p>

How do I add files to my GitHub repository? I'm using Windows and all my project files are in one folder and I just need to upload it to my repo.

解决方案

The general idea is to add, commit and push your files to the GitHub repo.

First you need to clone your GitHub repo.
Then, you would git add all the files from your other folder: one trick is to specify an alternate working tree when git add'ing your files.

git --work-tree=yourSrcFolder add .

(done from the root directory of your cloned Git repo, then git commit -m "a msg", and git push origin master)

That way, you keep separate your initial source folder, from your Git working tree.


Note that since early December 2012, you can create new files directly from GitHub:

ProTip™: You can pre-fill the filename field using just the URL.
Typing ?filename=yournewfile.txt at the end of the URL will pre-fill the filename field with the name yournewfile.txt.

这篇关于将文件添加到GitHub存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆