Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
student:eclipse:git [2021/03/11 15:13] bernstdhstudent:eclipse:git [2021/10/20 13:21] (current) bernstdh
Line 12: Line 12:
 To configure Git, click on <key>Window+Preferences</key>. Then, expand <key>Version Control</key>, expand <key>Git</key>, and click on <key>Configuration</key>. To configure Git, click on <key>Window+Preferences</key>. Then, expand <key>Version Control</key>, expand <key>Git</key>, and click on <key>Configuration</key>.
  
-Since many Git servers use your email address for authentication, it is important that the ''user.email'' value exists and is correct+Since many Git servers use your email address for authentication, it is important that the ''user.email'' key exists and that the value is your email address. It's useful if the "user.name" key exists and that the value is your personal name (e.g., first name) followed by a space and your family name (e.g., last name).
  
 You can edit an existing entry by clicking on it. You can add an entry by clicking on <key>Add Entry...</key> and then entering a key and value. Keys are hierarchical, with levels delimited by a ''.'' character (e.g., ''user.email''). You can edit an existing entry by clicking on it. You can add an entry by clicking on <key>Add Entry...</key> and then entering a key and value. Keys are hierarchical, with levels delimited by a ''.'' character (e.g., ''user.email'').
Line 26: Line 26:
  
   - Open the [[ #opening_the_git_perspective | Git Perspective ]]   - Open the [[ #opening_the_git_perspective | Git Perspective ]]
-  - Click on "Create a  Git repository"+  - Click on "Create a local Git repository"  (or the icon for creating a Git repository).
  
 Note that you should not put the repository under the directory containing the Eclipse workspace. Note that you should not put the repository under the directory containing the Eclipse workspace.
Line 78: Line 78:
 The "URI", "Host", "Protocol", and "Port" will vary with the Git host. The "URI", "Host", "Protocol", and "Port" will vary with the Git host.
  
-You will also be asked to provide a "User" and "Password" for that host. If you select "Store in Secure Store", Eclipse will save this information for you locally, and you will not need to provide it each time you push. Otherwise, you will need to authenticate yourself each time you push.+You will also be asked to provide a "User" and "Password" for that host. Because of recent security enhancements, you must enter your "Personal Access Token" in the "Password" field, not your GitHub password. (If you select "Store in Secure Store", Eclipse will save this information for you locally, and you will not need to provide it each time you push. Otherwise, you will need to authenticate yourself each time you push.)
  
  
Line 85: Line 85:
 The easiest way to clone a remote repository is to: The easiest way to clone a remote repository is to:
  
-  - Open the [[ #opening_the_git_perspective | Git Perspective ]] +  - Open the [[ #opening_the_git_perspective | Git Perspective ]]. 
-  - Click on "Clone a Git repository" +  - Click on "Clone a Git repository". 
-  - Enter the "URI", "Host", "Repository path", and "Protocol" +  - Enter the "URI", "Host", "Repository path", and "Protocol". 
-  - Enter your authentication information for the Git server +  - Enter your authentication information for the Git server.  (Because of recent security enhancements, you must enter your "Personal Access Token" in the "Password" field, not your GitHub password.) 
-  - Select the appropriate branch (probably the main branch, the name of which may vary but should be apparent from the context) and click on <key>Next</key>+  - Select the appropriate branch (probably the main branch, the name of which may vary but should be apparent from the context) and click on <key>Next</key>.
   - Enter the appropriate local directory for the "Destination", the appropriate "Remote name" (probably ''origin''), and click <key>Finish</key>.   - Enter the appropriate local directory for the "Destination", the appropriate "Remote name" (probably ''origin''), and click <key>Finish</key>.
  
 At this point, you will have cloned the repository but you will not have any Eclipse projects. To import a project from the repository, while still in the Git Perspective you should: At this point, you will have cloned the repository but you will not have any Eclipse projects. To import a project from the repository, while still in the Git Perspective you should:
  
-  - Expand the repository +  - Right-click on the repository 
-  - Expand the "Working Tree" +  - Select <key>Import Projects...</key> 
-  - Right-click on the project of interest +  - Select on the project(s) of interest
-  - Select <key>Import Projects</key>+
   - Click on <key>Finish</key>   - Click on <key>Finish</key>
  
 +Note: Some versions of Eclipse/Egit have a defect that require you to close Eclipse at this point and re-start it.
  
 ==== Responding to ''non-fast-forward'' Messages  ==== ==== Responding to ''non-fast-forward'' Messages  ====