如何使用本地git存储库填充github存储库?

时间:2015-08-01 22:21:04

标签: linux git github

我有一个本地git存储库工作没有问题。但是,我想发送此存储库以在github上填充新的存储库。通过github文档阅读我一直在阅读如何分支远程存储库或如何推送到远程存储库,而不是如何最初填充远程存储库。提前致谢

5 个答案:

答案 0 :(得分:1)

在本地存储库中:

git init

git add。

git commit -m'首次提交'

git remote add origin remote_repository_URL

git remote -v

git push origin master

请注意,remote_repository_URL是新创建的github存储库的URL。

答案 1 :(得分:1)

首先在github上创建一个存储库,并记下该存储库的url。现在转到您的本地存储库并添加新的源。使用命令。

git remote add origin paste/your/github/url

现在您可以使用命令

检查相同内容
git remote -v

如果反映与否。

现在只需输入命令

 git push origin master

并将所有本地存储库内容移动到您的Github存储库。

答案 2 :(得分:0)

一旦你在github上创建了repo,只需按照他们的说明进行操作,如:

git remote add origin https://github.com/username/reponame.git
git push -u origin master

答案 3 :(得分:0)

这个问题有点不清楚,但仍然是“最初填充”,我假设您希望创建新的存储库。

请在此处阅读:
https://help.github.com/articles/create-a-repo/

答案 4 :(得分:0)

如果您在GitHub上创建一个新的存储库,它们会告诉您该怎么做:

git remote add origin git@github.com:your_username/your_repository_on_github.git
git push -u origin master
相关问题