Jump to content

QESTNET Internal:Developer Setup Git: Difference between revisions

From QESTonline
No edit summary
John.meegan (talk | contribs)
No edit summary
 
Line 19: Line 19:
email = john.meegan@spectraqest.com
email = john.meegan@spectraqest.com
[merge]
[merge]
    tool = kdiff3
tool = kdiff3
[mergetool "kdiff3"]
[mergetool "kdiff3"]
    path = c:/Program Files (x86)/KDiff3/kdiff3.exe
path = c:/Program Files (x86)/KDiff3/kdiff3.exe
[diff]
[diff]
    tool = kdiff3
tool = kdiff3
[difftool "kdiff3"]
[difftool "kdiff3"]
    path = c:/Program Files (x86)/KDiff3/kdiff3.exe</nowiki>
path = c:/Program Files (x86)/KDiff3/kdiff3.exe</nowiki>
*Set up your public key: http://github.com/guides/providing-your-ssh-key . Note that the ~ directory in Git Bash corresponds to “C:\Users\Your.Name\”, so your SSH public key can be found in “C:\users\Your.Name\.ssh\id_rsa.pub” after you’ve generated it.
*Set up your public key: http://github.com/guides/providing-your-ssh-key . Note that the ~ directory in Git Bash corresponds to “C:\Users\Your.Name\”, so your SSH public key can be found in “C:\users\Your.Name\.ssh\id_rsa.pub” after you’ve generated it.
**By this point you will have a GitHub account and password, a private and public SSH key, and a password to access your private SSH key. This last password is just in case someone steals your computer, they cannot access your private key without a password. This prevents them from accessing anything you use your key for, such as GitHub, once you have added your public SSH key to GitHub.
**By this point you will have a GitHub account and password, a private and public SSH key, and a password to access your private SSH key. This last password is just in case someone steals your computer, they cannot access your private key without a password. This prevents them from accessing anything you use your key for, such as GitHub, once you have added your public SSH key to GitHub.

Latest revision as of 23:05, 19 August 2015

Initial Setup

  • Signup for a GitHub account www.github.com. Tell someone your username so they can add you to the appropriate SpectraQEST teams. For QESTNET you will need access to the qestnet repository.
  • Download and install Git from http://git-scm.com/download. Windows has two possible ways to run git: choose msysgit instead of Cygwin. When installing, choose all the options that they recommend for Windows development. Install again to something like “C:\Program Files (x86)\Git”.
    • You will be prompted about line ending conversions at some point. Use the auto-convert option, I think it’s the first option. It should produce the line “autocrlf = true” in the default config: “C:\Program Files (x86)\Git\etc\gitconfig”.
  • You can now:
    • Run the Git console using Git Bash, a shortcut (quotes included): "C:\Program Files (x86)\Git\bin\sh.exe" --login –i
    • Run Git GUI using this entire command (quotes included) in a shortcut: "C:\Program Files (x86)\Git\bin\wish.exe" "C:\Program Files (x86)\Git\libexec\git-core\git-gui"
    • A shortcut for both of these should have been created in the Start Menu automatically.
  • Your global Git configuration file “.gitconfig” is found under “C:\Users\Your.Name\.gitconfig”. Setup your username and email by using the following commands in Git Bash:
    • git config --global user.name “Your name”
    • git config --global user.email your.name@spectraqest.com
  • Download and install KDiff3 (this will be used as the merge tool for changes that can’t be automatically merged. Can maybe make it work with WinMerge, but haven’t tried.) This can be installed to the default location, something like “C:\Program Files (x86)\KDiff3”.
  • Setup Git to use KDiff3 and optionally Notepad++ as your editor instead of Vim by editing the global .gitconfig file. I find it easier to edit manually in Notepad++ than using the console. Here’s an example of a config file:
[core]
	editor = "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -nosession -noPlugin"
	autocrlf = true
[user]
	name = John Meegan
	email = john.meegan@spectraqest.com
[merge]
	tool = kdiff3
[mergetool "kdiff3"]
	path = c:/Program Files (x86)/KDiff3/kdiff3.exe
[diff]
	tool = kdiff3
[difftool "kdiff3"]
	path = c:/Program Files (x86)/KDiff3/kdiff3.exe
  • Set up your public key: http://github.com/guides/providing-your-ssh-key . Note that the ~ directory in Git Bash corresponds to “C:\Users\Your.Name\”, so your SSH public key can be found in “C:\users\Your.Name\.ssh\id_rsa.pub” after you’ve generated it.
    • By this point you will have a GitHub account and password, a private and public SSH key, and a password to access your private SSH key. This last password is just in case someone steals your computer, they cannot access your private key without a password. This prevents them from accessing anything you use your key for, such as GitHub, once you have added your public SSH key to GitHub.
  • Make the folder “C:\dev\” on your C Drive for development work.
  • Get a Git repository from GitHub via something like the following (note the URL comes from GitHub and changes depending on the project):
    • cd /c/dev/
    • git clone git@github.com:spectraqest/qestnet.upgrade.git
  • That’s pretty much it. There are plenty of tools you can try out to assist with using Git if you wish. Two of the most popular are: