如何将项目上传到Github [英] How to upload a project to Github

查看:172
本文介绍了如何将项目上传到Github的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在检查完此问题后,我仍然不知道如何获得项目上传到我的Git Hub仓库。



我是Git Hub的新手,我不知道该怎么做。我创建了一个Repository,但是我想上传我的项目。



我在存储库页面上查看了某种类型的上传按钮,但我没有看到任何类型的。



我查看了迄今为止提供的链接,但我仍然没有收到任何地方。他们提到命令行,是Windows命令行还是Git Bash?因为我无法做任何事情。



我也尝试过使用Git GUI,但是当我选择文件夹时,我希望它说它不是Git存储库.. 。它需要被压缩吗?我尝试在文件夹中添加.gitconfig文件,但它没有什么区别。



预先感谢:)

解决方案

由于我写了这个答案,github发布了一个原生的 windows客户端您可以使用 > sourcetree 在Windows上同时获得git和mercurial设置。






以下是您如何使用Windows:


  1. 如果您没有安装git,请参阅本文介绍如何设置它。

  2. 打开Windows命令提示符。

  3. 首先,在这个目录下创建一个新的仓库 git init
  4. code>。这会说初始化空git仓库在.... git中( ... 是路径)。
  5. 现在您需要通过将git添加到存储库来告诉git有关您的文件。用 git add filename 来做到这一点。如果你想添加所有的文件,你可以执行 git add。

  6. 现在你已经添加了文件并进行了更改,您需要提交所做的更改,以便git可以跟踪它们。键入 git commit -m添加文件 -m 可让您添加提交讯息

到目前为止,即使您没有使用github,上述步骤也是您会做的。他们是启动git存储库的正常步骤。请记住,git是分布式的(分散的),意味着你不需要有一个中央服务器(或者甚至网络连接)来使用git。

现在你想把更改推送到你的github托管的git仓库。通过告诉git添加一个远程位置,你可以通过这个命令来实现:

git remote添加源https://github.com/yourusername/your-repo-name.git



一旦你完成了,git现在知道了关于您的远程存储库。然后你可以告诉它推送(这是上传)你提交的文件:

git push -u origin master


After checking this question I still have no idea how to get a project uploaded to my Git Hub repository.

I'm new to Git Hub and I have no idea what to do. I created a Repository but i want to upload my project to it.

I've looked on the repository page for an upload button of some kind but I haven't seen anything of the sort.

I've looked at the links provided so far but I'm still getting no where. They mention command line, is that Windows command line or Git Bash? Because I can't get either to do anything.

I also tried using Git GUI but when I select the folder I want it says that it's not a Git repository...does it need to be zipped up? I tried adding the .gitconfig file in the folder but it doesn't make a difference.

Thanks in advance :)

解决方案

Since I wrote this answer, github released a native windows client which makes all the below steps redundant.

You can also use sourcetree to get both git and mercurial setup on Windows.


Here is how you would do it in Windows:

  1. If you don't have git installed, see this article on how to set it up.
  2. Open up a Windows command prompt.
  3. Change into the directory where your source code is located in the command prompt.
  4. First, create a new repository in this directory git init. This will say "Initialized empty git repository in ....git" (... is the path).
  5. Now you need to tell git about your files by adding them to your repository. Do this with git add filename. If you want to add all your files, you can do git add .
  6. Now that you have added your files and made your changes, you need to commit your changes so git can track them. Type git commit -m "adding files". -m lets you add the commit message in line.

So far, the above steps is what you would do even if you were not using github. They are the normal steps to start a git repository. Remember that git is distributed (decentralized), means you don't need to have a "central server" (or even a network connection), to use git.

Now you want to push the changes to your git repository hosted with github. To you this by telling git to add a remote location, and you do that with this command:

git remote add origin https://github.com/yourusername/your-repo-name.git

Once you have done that, git now knows about your remote repository. You can then tell it to push (which is "upload") your commited files:

git push -u origin master

这篇关于如何将项目上传到Github的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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