简体   繁体   English

Rails:Rubymine:GitHub

[英]Rails: Rubymine: GitHub

I can't seem to figure out how to commit my files to GitHub. 我似乎无法弄清楚如何将我的文件提交给GitHub。

I am using RubyMine 4.5 on the MAC 我在MAC上使用RubyMine 4.5

I have git set up locally 我在本地设置了git

I have a private account on GitHub 我在GitHub上有一个私人账户

From the RubyMine Preferences, I have my GitHub credentials properly set up (and acknowledged as such by RubyMine), but it did not give me an option to select a repository on GitHub. 从RubyMine首选项中,我正确设置了我的GitHub凭据(并由RubyMine确认),但它没有给我一个在GitHub上选择存储库的选项。

How do I commit file to the GitHub repository? 如何将文件提交到GitHub存储库? There are too many CVS and Git menu items in RubyMine. RubyMine中的CVS和Git菜单项太多了。

PS: I've read the online help sections (the only thing available to me), and I followed the instructions in the GitHub integration, but the directory I'm trying to commit is failing to push to GitHub, with RubyMine telling me that there was nothing to commit. PS:我已经阅读了在线帮助部分(我唯一可用的部分),并且我按照GitHub集成中的说明进行操作,但是我尝试提交的目录无法推送到GitHub,而RubyMine告诉我没有什么可以承诺的。 This is the first time I use RubyMine for GitHub. 这是我第一次将RubyMine用于GitHub。 Nothing about this on StackOverflow. StackOverflow上没有这个。

Okay, I think I've recreated your situation locally and it appears that RubyMine has terrible support for managing remotes. 好吧,我想我已经在本地重新创建了你的情况,看来RubyMine对管理遥控器有很大的支持。 If you create a Git repository locally, then (separately) create a repository on GitHub, there's no obvious way to marry the two from within RubyMine. 如果你在本地创建一个Git存储库,然后(单独)在GitHub上创建一个存储库,那么就没有明显的方法可以将这两个存储在RubyMine中。

Basically, you need to set up GitHub as a remote for your local repository from the shell, and once that's done then RubyMine will be able to push as normal. 基本上,您需要从shell将GitHub设置为本地存储库的远程,一旦完成,RubyMine就能正常推送。

Please note that the below instructions assume you want to overwrite your GitHub repository with the full history from your local repository -- If your GitHub repository has data that you do not want to lose, do not execute these commands! 请注意,以下说明假设您要使用本地存储库中的完整历史记录覆盖GitHub存储库 - 如果您的GitHub存储库包含您不想丢失的数据,请不要执行这些命令! See Below. 见下文。

Open up Terminal: 打开终端:

cd /path/to/my/project/root
git remote add origin https://github.com/yourusername/yourrepo.git
git push -u origin +master

Now, RubyMine should be able to push to your GitHub repository via VCS > Git > Push 现在,RubyMine应该能够通过VCS > Git > Push推送到您的GitHub存储库

If your GitHub repository has already been committed to and you don't want to lose those changes, you'll need to either create a new GitHub repo or clone your GitHub repo into another folder and merge your local repository into the clone. 如果您的GitHub存储库已经提交并且您不想丢失这些更改,则需要创建新的GitHub存储库或将GitHub存储库克隆到另一个文件夹并将本地存储库合并到克隆中。

This can be avoided entirely if you're trying to push your existing local repository to a new GitHub repo: Simply use the VCS > Import into Version Control > Share project on GitHub option and use the dialog to create a new GitHub repository. 如果您尝试将现有本地存储库推送到新的 GitHub存储库,则可以完全避免这种情况:只需使用VCS > Import into Version Control > Share project on GitHub选项VCS > Import into Version Control > Share project on GitHub然后使用该对话框创建新的GitHub存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM