Can't publish to GitHub
I have a GitHub account and I have previously been able to publish a project to GitHub using IntelliJ about 2 years ago. However, all my current attempts seem to fall short and I can't seem to find reliable instructions on how to do so. Here; is a lit of the problems I've had:
1. On my first attempt I selected VCS->Import into Version Control-> Share Project on GitHub but I was never prompted for the files I wanted to include. Instead, it published only the source file in my project (as individual files, not in the src folder.) I tried adding the lib directory and files, but only got errors. So, I deleted the project on GitHuB and tried again.
2. On my 2nd attempt, it kept telling me the project name was in use even though I'd deleted it using the GitHub web interface. I eventually found some files with my project name listed in Other Settings->Default Settings->Version Control and used the minus(-) operator to delete them and I was then able to get past the >name in use" dialog and got a tree-like window that listed all the files in my project. i unchecked those I didn't want to add but, oddly, the checkbox for the src folder was already checked but the tree did not enable me to open the "src" folder. This created a project that contained all the files and folders I had checked, but the src folder was empty...
34. I then again deleted the project from GitHub in order to try again, but the "Share Project on GitHub" dialog again complains that a project of that name already exists and when I now check in Other Settings->Default Settings->Version Control, there are no files listed that I can remove.
All in all, I'm finding this whole process quite frustrating... Can anyone explain how this process is supposed to work and how to deal with errors like the ones I've been getting?
Please sign in to leave a comment.
The Share on GitHub action does the following:
1. Creates a repository on GitHub using GitHub HTTP API
2. Checks if there is a local git repository associated with the project. Creates one, if there is no repository.
Upon creation, it asks you which files you want to add to the local repository. If you have a repository already, it does not ask you to select files.
3. Pushes all commits from the local git repository to the GitHub.
So, it appears you have a git repository already in your src folder
As for why it reports that Repository exists, are you sure it mentioned repository, but not the remote? Since you already published the project, the git repository mapped to it got a remote called origin by default, and subsequential efforts to publish would try t create a remote with the same name if you don't change it.
Thanks for taking the time to try to help. At first I didn't understand your comment about having a git repository in my src folder but, with a little research, I discovered that these are apparently setup in invisible folders on a Mac by prefixing the folder name with a period(.). Then, I was able to learn how to make these files visible by following the instructions here: https://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/ Note: in the process I was surprised to see that there are also invisible .idea folders in each of my IntelliJ project folders. I'm not sure if I condone this practice of putting things into invisible folders, but it might help explain some issues I've had with typing to copy IntelliJ project folders in the past.
So, with that knowledge, I deleted the invisible .git folder in my project's src folder and tried again after verifying that the project was also deleted on GitHub. I selected "Share Project on GitHub" and this time I got a tree of folder and files to check and uncheck. This also showed the invisible .idea folder as being rechecked for upload. I'm not sure why I would want to do that, as I don't know what's in these files, so I unchecked the .idea folder, as well as unchecking the .iml file for my project. This time, everything seemed to work just fine. I'm not sure what I mush have done wrong the first time, but now that I know about the invisible folders, I know what to do to start over and try to publish a project again.
So, as a follow ups, what is the purpose of the folders and files in the invisible .idea folder? is this documented someplace?
Wayne
.idea folder and .iml folder stores all the project configuration for IDEA. This folder should be visible in the Project view, btw. Refer to https://www.jetbrains.com/help/idea/project-and-ide-settings.html
Basically, it is recommended to version the .idea folder - see https://intellij-support.jetbrains.com/hc/en-us/articles/206544839-How-to-manage-projects-under-Version-Control-Systems
Git folder was the local git repository, it is created upon initialization of a repository in a folder. Now, after you shared the project, there is one in the root of your project
Now that you point it out, I do see the .idea folder in the project view. I'd noticed this before, but I'd assumed it showed the information in the .iml file. Now it all make a lot more sense to me. Thanks. And, if I follow you correctly, it sounds like I should check these files in to GitHub, as well. I hesitated because I wasn't sure if these files contained any sensitive information, such as my GitHub password, so thanks for the link to the article that talks about this issue.
Wayne