launchscout / nku

NKU Class Spring
5 stars 14 forks source link

How do to safely use github? #94

Closed alexkoepke closed 10 years ago

alexkoepke commented 10 years ago

I would like to be able to push my app to git hub and not share keys, passwords and the like with the rest of the world. How do I avoid doing such things?

Can i make my app private and share it with people? Can hide certain files?

jaimerump commented 10 years ago

You can set up a private repo, yes, but that costs money. It would probably be best to simply keep those files out of your repo if possible.

alexkoepke commented 10 years ago

How do I keep them out of my repo?

jaimerump commented 10 years ago

The easiest way would probably be to add them to your .gitignore so when you commit it automatically knows not to pick up those changes.

alexkoepke commented 10 years ago

Thank you I Just tried that however I need to figure out how to remove the files from my git gub.

jaimerump commented 10 years ago

I just found out that Github actually has an article on this sort of thing https://help.github.com/articles/remove-sensitive-data

alexkoepke commented 10 years ago

I found that as well and it kind of worked. However it didn't remove every thing. :( This is really frustrating.

On Tue, Apr 15, 2014 at 9:16 PM, jaimerump notifications@github.com wrote:

I just found out that Github actually has an article on this sort of thing https://help.github.com/articles/remove-sensitive-data

— Reply to this email directly or view it on GitHubhttps://github.com/gaslight/nku/issues/94#issuecomment-40553481 .

heflinao commented 10 years ago

This might work if you're looking to remove a file on your repository but keep it in your local copy. Once it's removed from the repository, if you haven't already, add it to your gitignore file.

http://stackoverflow.com/questions/1143796/git-remove-a-file-from-the-repository-without-deleting-it-from-the-local-filesy

alexkoepke commented 10 years ago

Thank you! However, that would not have soled my problem and I found a solution, not the best but my data is no longer on git hub.

First things first Never click the delete button! image

All it will do is create a giant red git commit that is not in your git log and cannot be removed via these methods, https://help.github.com/articles/remove-sensitive-data.

Solution: (please do your research before blindly following these steps)

  1. Chang your sensitive data.
  2. Copy links to all the commits on your git hub that weren't removed via https://help.github.com/articles/remove-sensitive-data
  3. Contact GitHub support - send them the links to commits that you gathered in step one
  4. Copy app to desktop/remote location.
  5. Find last good commit before sensitive data was pushed to git hub (some crazy long number can be found on github or in your git log).
  6. git reset --hard 0d1d7fc32 <--(that crazy long number)
  7. Replace your now reset app files with the app files that you saved in a remote location.
  8. Add file to .gitignore

    $ echo "YOUR_FILE_KEEP_THE_DOUBLE_QUOTES.rb" >> .gitignore
    $ git add .gitignore
    $ git commit -m "Add YOUR_FILE to .gitignore"
    # [master 051452f] Add YOUR_FILE to .gitignore
    #  1 files changed, 1 insertions(+), 0 deletions(-)```
  9. Force push your code to github.

    git push -f ```
  10. Remember to use this in the future!!!

    $ echo "YOUR_FILE_KEEP_THE_DOUBLE_QUOTES.rb" >> .gitignore
    $ git add .gitignore
    $ git commit -m "Add YOUR_FILE to .gitignore"
    # [master 051452f] Add YOUR_FILE to .gitignore
    #  1 files changed, 1 insertions(+), 0 deletions(-)```