setting up git with my pycharm project
This is simply what I want to do - put my project into its own git repository
I've created an empty git repo on my github account, so it has its URL -- https://github/<my_account>/<my_repo>.git
I have a Pycharm Python Project with a simple directory structure:
MyPyProject
|--MyPyProject_sub_folder1
|--myPyFile1.py
|--MyPyProject_sub_folder1
|--myPyFile1.py
|--someConfigFile.txt
I've tried two approaches that do not work:
1. Using the Settings \ VCS \ <Project> and Settings \ VCS \ GitHub \ <URL set to https://github/<my_account>/<my_repo>.git>
and
2. Manually going to the ~/path/to/MyPyProject and doing a .git init / add / commit / remote add pointing to https://github/<my_account>/<my_repo>.git
NEITHER WORK - they push a ton of .xml files and three directories that are not in MyPyProject (...the directories are "_linux", "colors", and "inspection")
The Jetbrains docs do not help at all....PLEASE HELP --> I just want MyPyProject and its contents in my_repo
Please sign in to leave a comment.
Figured it out...please let me know if there's a better way to do this...SHAME ON YOU Jetbrains for having such *** documentation!
### ------------ PyCharm Project to GitHub Setup: ------------ ###
- Create a new PyCharm project
- Create a repository on github, check it out (clone it) to the new PyCharm project directory,
- NOTE: This avoids tracking the '.idea' file and all its junk w.r.t. the PyCharm project dir, so you only version control the actual project content but have a nested git repo within the PyCharm project as a result of the setup.
- OR create the git repo, clone it, then put your already existing project files into that directory, and good luck pointing PyCharm to that dir as a project
- Add them to git -> add, commit, push
# Add the files from the local repository to stage them for commit
# This assumes you've checked out repo already w.r.t. above, otherwise do a $ git init for a new local repo
$ git add .
To unstage a file, use
$ git reset HEAD YOUR-FILE
# Commit the files that you've staged in your local repository
$ git commit -m "Initial PyCharm Project Commit"
To remove this commit and modify the file, use
$ git reset --soft HEAD~1
(and commit and add the file again)
# Verify the remote git repo
$ git remote -v
# Push the changes in your local repository to the remote repo
$ git push origin master