What this tutorial is about
One day, you may want to publish the results of your work. PyCharm makes it possible to share your local repository with whoever you want, using a repository located remotely, for example, GitHub. In this tutorial we'll go step by step through sharing your local Git repository on GitHub without leaving PyCharm.
What this tutorial is not about
Using GitHub per se is out of scope of this tutorial. Refer to the GitHub documentation instead.
Before you start
Make sure that:
- You are working with PyCharm version 2.7 or higher.
- The Git integration and GitHub plugins are enabled. These plugins are bundled and enabled by default. If they are not, enable these plugins.
- You have write access to GitHub storage. So first create an account and a remote repository following the storage-specific instructions.
- You continue the exercises started in the tutorial "Using PyCharm's Git integration locally"
Two ways to share source code
To publish your source code, you need write access to a remote storage, for example, to the GitHub storage.
To initiate publishing, open the project described in the tutorial "Using PyCharm's Git integration locally" if it is closed. Your further actions depend on the selected strategy, since PyCharm provides two ways of sharing your source code.
Note that all actions are performed with the current branch.
Sharing on GitHub
On the main menu, choose VCS→Import into Version Control→Share project on GitHub:
If you have your GitHub account properly configured, you will see the dialog box, where you have to specify the repository name and optional description:
Click Share - and behold your source code in a brand new remote repository.
Pushing your source code
Press Alt+` to show the VCS operations pop-up window, and then press 8 to invoke the Push command:
In the Git Push dialog box, you have to select specific revision to push. Note, however, that when doing the very first push of a branch, you have to select the check box below:
After pushing changes, PyCharm shows an information message in the balloon:
Again, if you go to your repository and choose the desired branch, you will see your source code successfully committed.