Manage projects hosted on GitHub
You can clone a repository that you want to contribute to directly from PyCharm and create a new project based on it.
From the main menu, choose Git | Clone . If the Git menu is not available, choose VCS | Get from Version Control .
In the Get from Version Control dialog, choose GitHub on the left.
Log in to GitHub by doing one of the following:
If you have a token, click Use token , then paste the token in the Token field, and click Log In .
Otherwise, click Log In via GitHub .
Enter your GitHub credentials in the browser window that opens. If you have two-factor authentication enabled, you will be asked to enter a code that will be sent to you by SMS or through the mobile application.
Select a repository from the list of all GitHub projects associated with your account and the organization that your account belongs to.
In the Directory field, enter the path to the folder where your local Git repository will be created.
If you want to create a project based on these sources, click Yes in the confirmation dialog. PyCharm will automatically set Git root mapping to the project root directory.
Share a project on GitHub
You can add a remote GitHub repository for a project you are developing locally, so that others can view it or contribute to it.
Open the project you want to share.
From the main menu, choose Git | GitHub | Share Project on GitHub .
If you have already registered your GitHub account in PyCharm, connection will be established using these credentials.
If you have not registered your account in PyCharm, the Login to GitHub dialog opens. Specify your access token or request a new one with your login and password.
When connection to GitHub has been established, the Share Project on GitHub dialog opens. Specify the new repository name, the name of the remote, and enter a description of your project.
You can select the Private option if you do not want to allow public access to your repository for other GitHub users.
Click Share to initiate a new repository and upload project sources to it.
Jump to the GitHub version of a file
You can jump from PyCharm to the GitHub version of a file. PyCharm detects which branch is currently active as well as the latest revision of the file, and opens the GitHub copy of the selected file in the corresponding commit in your web browser.
Do one of the following:
Select Git | GitHub | Open on GitHub from the main menu.
Select a file in the editor or in the Project view, and choose Open In | GitHub from the context menu.
Select the file in the Project view, press Control+Shift+A , and type Open on Github .
If you are signed in to GitHub, the remote version of the file will open in the browser.
Enter your GitHub credentials in the browser window that opens. If you have two-factor authentication enabled, you will be asked to enter a code that will be sent to you by SMS or through the mobile application.
If you are opening the GitHub file version from the editor, the file will be also automatically scrolled to the current line.
If the file points to more than one remote, you will be prompted to select the appropriate repository.
Set up a Git repository
When you clone an existing Git repository or put an existing project under Git version control, PyCharm automatically detects if Git is installed on your computer. If the IDE can’t locate a Git executable, it suggests downloading it.
PyCharm supports Git from the Windows Subsystem for Linux 2 (WSL2), which is available in Windows 10 version 2004.
If Git is not installed on Windows, PyCharm searches for Git in WSL and uses it from there. Also, PyCharm automatically switches to Git from WSL for projects that are opened when you use the \\wsl$ path.
If you need to manually configure PyCharm to use Git from WSL, go to the Version Control | Git page of the IDE settings Control+Alt+S , click the Browse icon in the Path to Git executable field, and select Git from WSL via the \wsl$ path, for example, \\wsl$\debian\usr\bin\git .
Check out a project from a remote host (git clone)
PyCharm allows you to check out (in Git terms, clone ) an existing repository and create a new project based on the data you’ve downloaded.
To start cloning a Git repository, do one of the following:
If the version control integration is already enabled, from the main menu, select Git | Clone .
If the version control integration is not enabled yet, from the main menu, select VCS | Get from Version Control .
Alternatively, from the main menu, select File | New | Project from Version Control .
If no project is currently open, click Get from VCS on the Welcome screen.
In the Get from Version Control dialog, specify the URL of the remote repository you want to clone or select one of the VCS hosting services on the left.
If you are already logged in to the selected hosting service, completion will suggest the list of available repositories that you can clone.
Click Clone . If you want to create a project based on the sources you have cloned, click Yes in the confirmation dialog. Git root mapping will be automatically set to the project root directory.
If your project contains submodules, they will also be cloned and automatically registered as project roots.
In the Trust and Open Project ‘<project_name>’? project security dialog, select the way you want to open the project: Trust Project or Preview in Safe Mode .
Put an existing project under Git version control
You can create a local Git repository based on the existing project sources.
Associate the entire project with a single Git repository
Open the project that you want to put under Git.
Press Alt+` to open the VCS Operations Popup and select Enable Version Control Integration .
Alternatively, from the main menu, select VCS | Enable Version Control Integration .
Choose Git as the version control system and click OK .
The entire project will then be associated with a single Git directory, so there is no need to add each file to the Git directory individually.
After VCS integration is enabled, PyCharm will ask you whether you want to share project settings files via VCS. You can choose Always Add to synchronize project settings with other repository users who work with PyCharm.

If there is no Enable Version Control Integration option available in the VCS Operations Popup , it means that Git version control is already enabled for the project.
Associate different directories within the project with different Git repositories
Open the project that you want to put under Git.
From the main menu, choose VCS | Create Git Repository .
In the dialog that opens, specify the directory where a new Git repository will be created.
Git does not support external paths, so if you choose a directory that is outside your project root, make sure that the folder where the repository is going to be created also contains the project root.
If you are creating multiple Git repositories inside the project structure, repeat the previous steps for each directory.
After you have initialized a Git repository for your project, you need to add project files to the repository.
Add files to the local repository
In the Commit tool window Alt+0 , expand the Unversioned Files node.
Select the files you want to add to Git or the entire changelist and press Command Alt A or choose Add to VCS from the context menu.
You can also add files to your local Git repository from the Project tool window: select the files you want to add, and press Command Alt A or choose Git | Add from the context menu.
When Git integration is enabled in your project, PyCharm suggests adding each newly created file under Git, even if it was added from outside PyCharm. You can change this behavior in the Version Control | Confirmation page of the IDE settings Control+Alt+S . If you want certain files to always remain unversioned, you can ignore them.
If you attempt to add a file that’s on the .gitignore list, PyCharm will suggest force-adding it. Clicking Cancel in the confirmation dialog only cancels force-adding ignored files – all other files will be added to the Git repository.
Exclude files from version control (ignore)
Sometimes you may need to leave certain files unversioned. These can be VCS administration files, artifacts of utilities, backup copies, and so on. You can ignore files through PyCharm, and the IDE will not suggest adding them to Git and will highlight them as ignored.
You can only ignore unversioned files, that is, files that you see in the Unversioned Files changelist. If a file is added to Git but not committed, you can right-click it in the Local Changes view and choose Rollback .
Git lets you list ignored file patterns in two kinds of configuration files:
Patterns listed in this file only apply to the local copy of the repository.
This file is created automatically when you initialize or check out a Git repository.
One or more .gitignore files in the VCS root directory and its subdirectories.
These files are checked into the repository so that the ignore patterns in them are available to the entire team. Therefore, it is the most common place to store the ignored file patterns.
If there is no .gitignore file in the VCS root directory, you can right-click anywhere in the Project tool window, choose New | File , and type .gitignore in the New File dialog.
To create a .gitignore file in Windows Explorer, create a file named .gitignore. and Windows will rename it automatically to .gitignore .
Add files to .gitignore or .git/info/exclude
Decide what kind of Git configuration file you are going to use to ignore files. If in doubt, use .gitignore .
Locate the unversioned file or folder you want to ignore in the Local Changes view or in the Project tool window. File colors in these views help you identify the status of the file.
Right-click the selection and choose Git | Add to .gitignore or Git | Add to .git/info/exclude .
File colors in these views help you identify the status of the file.
If you need to exclude files by a certain pattern or type, you can edit the .gitignore or .git/info/exclude file directly. See .gitignore patterns format.
If you want ignored files to be also displayed in the Local Changes view, click on the toolbar and select Show Ignored Files .
Check project status
PyCharm allows you to check the status of your local working copy compared to the repository version of the project. It uses specific colors to let you see which files have been modified, which new files have been added to the VCS, and which files are not being tracked by Git.
Open the Local Changes view.
The Changes changelist shows all files that have been modified since you last synchronized with the remote repository (highlighted in blue) and all new files that have been added to the VCS but have not been committed yet (highlighted in green).
The Unversioned Files changelist shows all files that have been added to your project but that are not being tracked by Git.
Track changes to a file in the editor
You can also track changes to a file as you modify it in the editor. All changes are highlighted with change markers that appear in the gutter next to the modified lines and show the type of changes introduced since you last synchronized with the repository. When you commit changes to the repository, change markers disappear.
The changes you introduce to the text are color-coded:
line added.
line changed.
line deleted.
You can customize the default colors for line statuses on the Editor | Color Scheme | VCS page of the IDE settings Control+Alt+S .
To disable VCS markers in the gutter, deselect the Highlight modified lines in gutter option on the Version Control | Confirmation page of the IDE settings Control+Alt+S .
You can manage changes using a toolbar that appears when you hover the mouse cursor over a change marker and then click it. The toolbar is displayed together with a frame showing the previous contents of the modified line:


You can roll back changes by clicking and explore the differences between the current and the repository version of the current line by clicking . To highlight the fragments that were changed, click .
Instead of reverting the whole file, you can copy any part of the contents of this popup and paste it into the editor.
Add a remote repository
If you created a Git repository based on local sources, you need to add a remote repository to be able to collaborate on your Git project, as well as to eliminate the risks of storing your whole codebase locally. You push changes to a remote repository when you need to share your work and pull data from it to integrate changes made by other contributors into your local repository version.
If you have cloned a remote Git repository, for example, from GitHub, the remote is configured automatically, and you do not have to specify it when you want to sync with it. The default name Git gives to the remote you’ve cloned from is origin .
Define a remote
Create an empty repository on any Git hosting, such as Bitbucket or GitHub. You can create a repository on GitHub without leaving PyCharm: see Share a project on GitHub.
Invoke the Push dialog when you are ready to push your commits by selecting Git | Push from the main menu, or press Command Shift K .
If you haven’t added any remotes so far, the Define remote link will appear instead of a remote name. Click it to add a remote.
In the dialog that opens, specify the remote name and the URL where it will be hosted, and click OK .
Add a second remote
In some cases, you also need to add a second remote repository. This may be useful, for example, if you have cloned a repository that you do not have write access to and are going to push changes to your own fork of the original project. Another common scenario is that you have cloned your own repository, which is somebody else’s project fork, and you need to synchronize with the original project and fetch changes from it.
From the main menu, choose Git | Manage Remotes . The Git Remotes dialog will open.
Click the Add button on the toolbar or press Alt+Insert .
In the dialog that opens, specify the remote name and URL and click OK .
To edit a remote (for example, to change the name of the original project that you have cloned), right-click the remote branch in the Branches pane of the Git Log tool window and select Edit Remote from the context menu.
You can also edit a remote from the Push Dialog by clicking its name.
To remove a repository that is no longer valid, right-click it in the Branches pane of the Git Log tool window, and select Remove Remote from the context menu.
How to Clone Web Project from GitHub in Pycharm using Git?
PyCharm is one of the most popular Python-IDE developed by JetBrains used for performing scripting in Python language. PyCharm is an integrated development environment used in computer programming. PyCharm provides some very useful features like Code completion and inspection, Debugging process, support for various programming frameworks such as Flask and Django, Package Management, etc. PyCharm provides various tools for productive development in Python.
Git is an open-source version control system. It means that whenever a developer develops some project (like an app or website) or something, he/she constantly updates it catering to the demands of users, technology, and whatsoever it maybe, Git is a version control system that lets you manage and keep track of your source code history. Find the appropriate web project according to your requirement in GitHub. You may also go through this link to find a project on TextUtils Website.
To know about uploading Project on GitHub refer to How to Upload Project on GitHub from Pycharm.
Step by Step Implementation
Step 1: After selecting your project click on the Green-colored Code button then copy the hyperlink as shown in the below image. You may copy the link manually or by just click on the Copy icon.

Step 2: Open your Pycharm then go to the VCS > Get From Version Control as shown in the below image.

Step 3: Then at last paste the link in the URL and choose your Directory. Click on the Clone button and you are done.
Настройка PyCharm
PyCharm Professional Edition очень мощная IDE для Python. IDE замечательно работает «из коробки», но если её слегка настроить, то она будет еще удобнее. Статья не претендует на лучшую в своем роде, я просто расскажу как я настраиваю IDE для себя на MacOS.
Интеграция с GitHub
Интеграция с GitHub (если вы используете этот сервис) позволит выполнять большинство рутинных операция прямо в IDE. Чтобы провести интеграцию, необходимо в окне Preferences найти Version Control → GitHub и там нажать на плюсик и выбрать Log In with Token. У вас выскочит такое окошко
Жмите Generate и вас перекинет на github.com в раздел создания токена. Настройки выставятся автоматом (но вы можете выбрать и другие), нужно будет только поменять название (по желанию) и выставить дату. Токен не закончится внезапно, GitHub предложит продлить его и вам не надо будет повторять эту процедуру (нужно будет просто нажать на специальную кнопку на сайте; Github подскажет), т.к. токен уже в вашей IDE.
Если всё выставили, жмите зеленую кнопку Generate Token и затем копируйте его.

Свежий токен вставляйте в окно PyCharm и жмите Add Account. В окне настроек появится ваш аккаунт.
Клонирование проекта с GitHub
Когда настроена интеграция, то клонировать проект с GitHub проще простого! В меню нужно открыть пункт Git → Clone (или кнопку Get from VCS, если у вас открыто главное окно IDE), выбирайте нужный репозиторий и жмите Clone.

Настройка Virtual Environment
Если вы клонировали репозиторий в котором нет файла requirements.txt, или просто создали проект локально, то у вас не создается Virtual Environment. Тем не менее, создать его не составит труда: в нижней части экрана у вас будете отображаться системная версия Python. У меня это Python 2.7.

Для создания виртуальной среды нужно кликнуть на Python 2.7 и нажать Add Interpreter. В открывшемся окне необходимо сделать (вообще-то почти ничего делать не надо, оно само. ) все как на скриншоте ниже, а именно:
- Выбрать New environment
- Задать нужный путь (папка проект\venv)
- Выбрать нужную вам версию Python
- Нажать OK

После этих простых манипуляций внизу окна, вместо Python 2.7, появится надпись Python 3.7 (project-name).
Что нам это дает? При открытии терминала в IDE у вас будет автоматически запускаться терминал в виртуальной среде.
Но если у вас в репозитории есть файл requirements.txt, то PyCharm после клонирования запустит диалоговое окно для создания Virtual Environment, где нужно просто убедится, что venv будет создан в нужном вам месте и правильно выбраны интерпретатор и файл с зависимостями requirements.txt.

Как только нажмёте кнопку OK, PyCharm запустит аналоги следующих команд:
Готово! Папка venv создана, зависимости установлены
Настройка Code Style
PyCharm любит PEP8, но не всегда следует. В настройках можно найти Code Style (кстати, поиск по настройкам замечательно работает) и поменять ограничение по длине строки. Справа сразу можно видеть превью кода, что очень удобно во время настройки 🙂
Если залезть в пункт Scheme, то можно выбрать для чего вы меняете настройки: для проекта или всей IDE. Это очень удобно, когда для разных проектов разные требования по оформлению.
Чтобы настроить форматирование шаблонов для Django, надо залезть в настройки HTML. Все остальные настройки меня вполне устраивают 🙂

Интеграция с Django
Для интеграции с Django много не нужно. Сперва необходимо дать знать IDE, что наш проект — это Django. Делаем как на скриншоте: выбираем путь к корневой папке проекта (там где лежит manage.py) и указываем файл settings.py и manage.py (все пути должны быть относительно Django project root)

Затем можно сказать IDE какие папки за что отвечают. И тогда PyCharm не будет искать где у вас корень проекта, статика, тесты или шаблоны, а сразу будет знать куда смотреть. Помогите IDE и она поможет вам в работе 🙂
Делается это так: жмём правой кнопкой на нужную папку и выбираем пункт меню Mark Directory as. А далее тот подпункт, который соответствует выбранной папке:
- Source Root для корневой папки проекта
- Excluded для папок, в которые PyCharm не должен смотреть (индексация, поиск и т.д.)
- Test Source Root для папок с тестами
- Resource Root для папки со статикой
- Template Folder для папки с шаблонами
В итоге должно получится нечто такое:

Конфигурации для запуска Django Server, Django Test
В этом разделе мы ускоряем процесс запуска тестов и dev-сервера. Да, я ленив и запускать dev-сервер и тесты консольной командой не мой случай. PyCharm придумали тоже ленивые ребята, поэтому они сделали возможность добавления различных конфигураций запуска.
Тыкаем на Add configuration в верхней части окна и далее на Add new

Там выбираем Django Server. В Name пишем понятное название, в поле Host указываем IP-адрес, в поле Port — порт. Все остальное не обязательно.
Тут же жмём на «+» и добавляем конфигурацию Django test — там вообще ничего не надо настраивать — все само.

После жмём ОК и запускаем выбранную конфигурацию с помощью горячих клавиш (для MacOS это control + R). В случае с сервером это просто удобно, а с тестами — очень удобно! IDE подсвечивает каждый тест, который не сработал и так намного проще работать. Результат на скрине ниже:

С помощью кнопки «1» можно запустить заново все тесты, а с помощью кнопки «2» — только те тесты в которых ошибка. «Удобно» — не то слово
Это тот минимум настроек, который позволяет мне работать с проектами немного быстрее. Статья будет дополняться 🙂