将现有项目推入Github [英] Push existing project into Github
本文介绍了将现有项目推入Github的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的项目资源有一个文件夹。我如何将这个项目推入Github的仓库?
I have a folder with my project sources. How I can push this project into Github's repository?
我试过使用这个步骤:
I tried using this steps:
- 我在GitHub上创建了空的存储库。
- 我运行git-bash并键入
git init
,所以在project root里面出现.git
文件夹。 - 我使用
添加了一些文件到版本控制> git add sourcesFolderName
- 在上一步中使用
git commit -m初始提交
- 我使用
指定远程存储库> git remote add MyProject< url>
- 最后
git push
,但没有任何内容被推送到远程回购... (无授权失败)
- I created empty repository on GitHub.
- I run git-bash and typed
git init
, so inside project root appeared.git
folder. - I added some files to version control using
git add sourcesFolderName
- I committed files added in previous step using
git commit -m "initial commit"
- I specified remote repository using
git remote add MyProject <url>
- Finally
git push
, but nothing is pushed to remote repo... (no authorization failure)
那么我怎样才能将现有资源推入新创建的github回购?
So how I can push existing sources into newly created github repo?
推荐答案
git init
git add .
git commit -m "Initial commit"
git remote add origin <project url>
git push -f origin master
-f
git push
上的code>选项强制推送。如果你不使用它,你会看到这样的错误:
The -f
option on git push
forces the push. If you don't use it, you'll see an error like this:
To git@github.com:roseperrone/project.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:roseperrone/project.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first merge the remote changes (e.g.,
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
这篇关于将现有项目推入Github的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文