ad_728x90

參觀我的【 伊生活小舖】

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:
Egit-0.10-github-create-repo.png

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.
Egit-0.10-github-cloneurl.png

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:
Egit-0.10-ssh-preferences.png
  • 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.
Egit-0.10-github-pushurl.png
  • 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).
Egit-0.10-github-push-refspec.png
  • Click Next. The push confirmation dialog will show a preview of the changes that will be pushed to the destination repository.
Egit-0.10-github-push-preview.png
  • Click Finish to confirm that you want to push these changes.
  • The next dialog reports the result of the push operation.
Egit-0.10-github-pushresult.png
  • Point your browser at your GitHub repository to see that your new repository content has arrived.
Egit-0.10-github-pushed-repo.png

EclipseCon 2012 Git Tutorial

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

COMMENTS HAVE BEEN DISABLED FOR THIS POST [文章的評論已被禁用]

Ratings and Recommendations by outbrain