Using git and github from PyCharm

In last week’s class, I demoed using Sourcetree to manage your repositories. I didn’t show how to use the features in PyCharm for the same purpose.

Here are a some screenshots that should help.

The first step is to set up your repository. You can do this through the VCS menu item.

PyCharm->VCS

 

When you select “Github”, you’ll get the following dialog box. You should use the URL for your own repository, not the original that I provided.


Screen Shot 2014-09-28 at 4.49.50 PM

 

The things that can go wrong.

  • You don’t have a git client installed. (Solution is to install on– Mac or Win.)
  • PyCharm can’t find your git.exe.  This is a problem on Window only.  A solution is on Stackoverflow. Make changes to your Settings for Git.
  • Can’t log in. Check your password.

Once your project is set up, you can use the following menu items to commit to your staging area, and push/pull to github.

Screen Shot 2014-09-28 at 4.39.30 PM

 

Things that can go wrong.

  • You don’t see these options. It means that the files that you are working on aren’t under version control. You’re working on the wrong directory.
  • You can’t push. It could mean that you didn’t commit before pushing. Commit first to your staging area and then push.
  • You can’t push. It could mean that your code is out of date. Pull first. Resolve any conflicts. Commit and try pushing again. (If your partner is working at the exact same time, you might have to do this more than once.)
  • You can’t see your partner’s changes. Check that you are both working from the same URL on github.

 

If you want to learn more about git, read this introduction to git concepts. There’s also a 15-minute hands-on interactive course from Codeschool that teaches the command line version of git. It will provide a solid foundation, but goes way beyond what you need to know to get Assignment 1 done.

Leave a Reply