我的老板在github上创建了一个空项目。同时,我在没有git的本地计算机上开发应用程序。现在如何通过远程创建的项目“分配”我的本地应用程序?(github的)
我可以从github的不同目录中提取项目,将文件复制到此目录中,然后执行commit / push。但是有没有更好的方法而不创建新目录?
只需将github-repository添加为存储库中的远程目录,然后就可以将工作推送到github:
git remote add origin https://github.com/user/repo.git #setUp github as remote
git push origin # push your changes to github
如果您的工作现在不在存储库中,则只需初始化一个新文件并提交更改
git init #in project folder
git commit -m 'initial commit'
#setUp remote with above code
#git push origin
请注意
仅添加远程仓库可能不会设置master
为上游分支,因此您可能必须使用:
git push origin master
如果您不想总是使用分支名称来进行推送,则可以使用以下命令将分支设置为上游分支
git branch --set-upstream my_branch origin/my_branch
之后,git push origin
将为所有分支机构提供上游服务
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句