參觀我的【 伊生活小舖】

2015年9月25日 星期五

[Share GitHub Tutorial] How to push an existing eclipse project to github ?

GitHub Tutorial

Create Local Repository

Create Repository at GitHub

  • create a new repository at GitHub:

On the next screen you can see the URLs you may use to access your fresh new repository:
  • click SSH to choose the SSH protocol. It can be used for read and write access.
  • click HTTP to choose the HTTP protocol. It can also be used for read and write access.
  • click Git Read-Only to choose the anonymous git protocol for cloning. It's the most efficient protocol git supports. Since the git protocol doesn't support authentication it's usually used to provide efficient read-only access to public repositories.

Eclipse SSH Configuration

  • Open the Eclipse Preferences. Navigate to and expand the Network Connections option and select SSH. Ensure that your SSH2 home is configured correctly (usually this is ~/.ssh) and contains your SSH2 keys:
  • if you don't have SSH keys yet you may generate them on the second tab of this dialog (Key Management). Use a good pass phrase to protect your private key, for more details see "working with key passphrases".
  • upload your public SSH key to your GitHub account settings.
Further information about advanced SSH configuration (such as using Putty or another SSH agent with EGit) is available in the EGit FAQ (section SSH).

Push Upstream

  • Click Team > Remote > Push... and copy and paste the SSH URL of your new GitHub repository.
  • If you are behind a firewall which doesn't allow SSH traffic, use the GitHub HTTPS URL instead and provide your GitHub user and password instead of using the uploaded public SSH key. To store your credentials into the Eclipse secure store click Store in Secure Store.
  • Note: many HTTP proxies are configured to block HTTP URLs containing a user name, since disclosing a user name in an HTTP URL is considered a security risk. In that case remove the user name from the HTTP URL and only provide it in the user field. It will be sent as an HTTP header.
  • Click Next and on first connection accept GitHub's host key.
  • Enter your SSH key's passphrase and click OK.
  • On the next wizard page click Add all branches spec to map your local branch names to the same branch names in the destination repository (on a one-to-one basis).
  • Click Next. The push confirmation dialog will show a preview of the changes that will be pushed to the destination repository.
  • Click Finish to confirm that you want to push these changes.
  • The next dialog reports the result of the push operation.
  • Point your browser at your GitHub repository to see that your new repository content has arrived.

EclipseCon 2012 Git Tutorial

Find all exercises and the slides here.
Follow the exercise #1 to prepare for the Git Tutorial.


Ratings and Recommendations by outbrain