Existing PyCharm project, Existing GitHub Repository: How to link the two?
Hello!
I have an “empty” PyCharm project (with venv and specific Python interpreter support). I have a GitHub repository. How do I link the two such that the local (i.e. “empty”) project becomes a clone of the GitHub repository? (main branch for now)
I tried to type in the git commands from project terminal window, but somehow that removed the Python interpreter reference (bewildering?) I need help so that I can perform this same set of operations for many other projects.
If I clone first and then create the project, an error message is issued, and the project is not created because the folder for venv already exists. If I create the project and then use the git add command, the error is that local commit(s) exist, even with merge overrides. I tried to stash the local commits but that didn't help.
Any advice would be sincerely appreciated. Thanks.
Regrds.
Please sign in to leave a comment.
You will first have to “git clone” the project to an existing local directory
with respect to the venv problem make sure when you point to a new project, answer yes to the “use existing sources”; Also use the option “Use existing virtual environment”
Hello Humberto,
Thanks for fielding my request.
When I enter git clone <github url> in my PyCharm project, I get the message that the folder is not empty.
Here are two of the many variations that I have been unsuccessful with:
Test 1:
Test 2:
Test 3:
Still no luck! Anything else that I can try? Thanks.
Regards.
The easy way is to :
File -→ Project From Version Control
This assume you have set up the git plugin
Enter the github URL;
PyCharm then prompts you to create the venv
If you have a requirements.txt it will even load those modules for you
To create a project from the github repo please do the following:
1. Prepare an empty directory for your project.
2. Open PyCharm, Get from VCS -> Enter git URL or use your VCS account -> Specify directory from the first step -> Clone
3. Once the repo is cloned, create a new Python interpreter for the project (local virtual environment also will require dedicated directory).
If you encounter any issues, please let us know and take some screenshots of the problem.