Skip to content

Commit

Permalink
Prompt for username/password if none is provided in config or args
Browse files Browse the repository at this point in the history
Now it will act more like trying to push commits to GitHub via HTTP.

This is more secure than having to store the password somewhere.
  • Loading branch information
IQAndreas committed Sep 15, 2013
1 parent 48917c8 commit 06b6910
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Fork of one of the tools by [Max Korenkov](https://github.com/mkorenkov) separat

Rename `config.ini.sample` to `config.ini`, and edit the fields to match your login info and repository info. Store the config file in the same folder as the `gh-issues-import.py` script, or store it in a different folder, using the `--config <file>` option to specify which config file to load in.

**Warning:** The password is stored in plaintext, so avoid storing the config file in a public repository. To avoid this, you can instead pass the username and/or password as arguments by using the `-u <username>` and `-p <password>` flags respectively.
**Warning:** The password is stored in plaintext, so avoid storing the config file in a public repository. To avoid this, you can instead pass the username and/or password as arguments by using the `-u <username>` and `-p <password>` flags respectively. If the username or password is not passed in from either of these locations, the user will be prompted for them when the script runs.

Run the script with the following command to import all open issues into the repository defined in the config:

Expand Down
7 changes: 7 additions & 0 deletions gh-issues-import.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ def init_config():
config.set('settings', 'import-milestone', str(not args.ignore_milestone))
config.set('settings', 'import-labels', str(not args.ignore_labels))

# Prompt for username/password if none is provided in either the config or an argument
if not config.has_option('login', 'username') :
config.set('login', 'username', input("Enter your username for GitHub.com: "))
if not config.has_option('login', 'password') :
import getpass
config.set('login', 'password', getpass.getpass("Enter your password for GitHub.com: "))

#TODO: Make sure no config values are missing

global source_url, target_url
Expand Down

0 comments on commit 06b6910

Please sign in to comment.