How to upload files to github when using pycharm

Hi I am new to python and pycharm.

I have created a repository on github. I already have some files on my computer and I would like to upload to the repository through pycharm. However if I used clone function, it basically created a new folder on my computer. If I use “share my project on github”, I would end up with a new repository on github. I don’t want either. I just would like to upload the files I already have on my computer to the existing repository.

Sorry the question seems basic. I am very new to pycharm. I tried to look up online, but didn’t find any clear instruction on how to do it. Thank you all

Hi, I use pycharm as well, but have yet to integrate it to git.

What I have been using to upload my pycharm projects to GitHub is this 3 minute video that explains how to upload any kind of project to github:

Clear, short concise and always works.

Thank Beatrix. Will give it a try

I have two methods:

  1. use the terminal:
git add filename.py
git commit -m "commit message"
git push
  1. use the git interface provided by pycharm. This one i don’t use it that much, but the workflow is the same since pycharm wraps the commands above in a nice interface.
    There should be a “Commit” menu on your dock. There you can select which files to add, then you have the option to commit or commit + push.

Remember that, for the files to appear online(on github) you need to push the changes.

HI Esperasan. I’ve used GitHub with PyCharm, but haven’t done exactly what you’re trying to do. I believe Git will create a local copy of the repo and then you can add your local files and sync with the remote repo, probably with “commit” and “push”. I would recommend reviewing the VCS section of this site and specifically the section on Git: Git | PyCharm. I think this is what you want to do, but please read the earlier sections to enable Git integration, etc first: Commit and push changes to Git repository | PyCharm
Good luck!

Hi Esperasan,

I suggest you also learn to use the Git CLI. There is nothing wrong with using the Git Integration of your Code editor or IDE. But code editors and IDEs may change from working place to working place. The Git CLI on the other hand will always be there for you :slight_smile:

Personally, I use VSCode at work, but perform all Git interactions with the CLI and I can just be as fast doing so as any of my other collegues.

best
Dennis

Hi Dennis. Are you saying that employers dictate to their developers which IDEs they must use? I worked for same company many years and we had the freedom to choose whatever tools we wanted. Just curious.

I wouldn’t say they dictate it to you. But you might want to use a different Code Editor or IDE depending on the operating system and technology stack used in your next position.

Also keep in mind that some IDEs require a license. My employer for example offers to pay a JetBrains Ultimate subscription while many others do not offer this perk.

I think it is in general a good idea to learn the tools that are available in all working environments and provide a similar user experience.

This often applies to command line interfaces.