我有一个android项目,我正在研究它,它目前不驻留在任何类型的源代码控制上.
我创建了自己的github帐户并在那里创建了一个存储库,现在我想提交并将我的android项目推送到该repo.
我怎么做?
我试过做一个git checkout但它不起作用,并说该项目不是一个git repo.
fatal: Not a git repository (or any of the parent directories): .git
Run Code Online (Sandbox Code Playgroud)
有什么建议?
您需要一个可以先同步的本地git存储库.输入您的基本源文件夹并键入:
git init
Run Code Online (Sandbox Code Playgroud)
这初始化了一个新的git存储库.然后你需要提交你的代码.
git add *
git commit -m "Initial commit"
Run Code Online (Sandbox Code Playgroud)
现在你可以同步了.为此,您必须将远程存储库添加到本地存储库. https://help.github.com/articles/adding-a-remote
git remote add origin https://github.com/user/repo.git
Run Code Online (Sandbox Code Playgroud)
完成后,您可以使用以下命令推送本地文件:
git push origin master
Run Code Online (Sandbox Code Playgroud)
其中origin是远程存储库的名称,并掌握分支的名称.
Ps.:你还必须同步SSH密钥才能工作. https://help.github.com/articles/generating-ssh-keys
编辑:如果您不确定这意味着什么,请直接前往Github训练营:https: //help.github.com/categories/54/articles
| 归档时间: |
|
| 查看次数: |
3160 次 |
| 最近记录: |