从本地存储库推送到GitHub托管的远程 [英] Pushing from local repository to GitHub hosted remote

查看:313
本文介绍了从本地存储库推送到GitHub托管的远程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在开发机器上使用Git GUI创建了我的Visual Studio 2010解决方案文件夹的本地存储库。然后我在我的GitHub帐户中创建了一个远程存储库。现在,我正在寻找如何将本地存储库推送到远程存储库。

I created a local repository of my Visual Studio 2010 solution folder using Git GUI on my dev machine. I then created a remote repository in my GitHub account. Now, I am looking for how to push my local repository to the remote repository.

在SVN中,我可以使用TortoiseSVN进行提交,并将更改推送到远程存储库。我没有看到类似Git的工具。

In SVN I can just commit using TortoiseSVN and changes are pushed to the remote repository. I don't see any tool like that available for Git.

如何将我的本地仓库推送到GitHub上的远程仓库?

How do I push my local repo to my remote repo on GitHub?

推荐答案

使用 git push 命令将您的本地存储库推送到远程存储库后,首先使用 git remote add [别名] [url] 命令。如果您访问您的Github存储库,它会显示您用于推送的URL。您将首先输入如下内容:

You push your local repository to the remote repository using the git push command after first establishing a relationship between the two with the git remote add [alias] [url] command. If you visit your Github repository, it will show you the URL to use for pushing. You'll first enter something like:

git remote add origin git@github.com:username/reponame.git

除非您通过针对远程存储库运行 git clone 在这种情况下,这一步已经为您完成了。

Unless you started by running git clone against the remote repository, in which case this step has been done for you already.

之后,您将输入:

And after that, you'll type:

git push origin master

可以简单地输入:

After your first push, you can simply type:

git push

,以便将来更新远程存储库。

when you want to update the remote repository in the future.

这篇关于从本地存储库推送到GitHub托管的远程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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