%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
Â
Introduction to git administration
1. Introduction to Git Administration
For New Administrators
Shawn Doyle
ReleaseTEAM Inc
sdoyle@releaseteam.com
www.linkedin.com/in/releaseteam/
http://twitter.com/ReleaseTEAMInc
2. Premium SCM Consulting firm since 1999
Focus on Software Configuration Management
On site and remote consulting services
â Build Automation
â CM tool administration, customization, upgrades, migrations
Classroom training / hands-on mentoring
R
e
l
e
a
s
e
T
E
ClearCase ClearQuest Jenkins
Git RTC Build Forge
SVN Jira Electric Commander
Shawn Doyle - ReleaseTEAM
3.
4. ï For the administrator new to Git
ï An overview of Git
ï Workflows
ï Common admin tasks
ï Access control
ï Triggers
ï Stories from the trenches
Subversion & Git Presentation
Agenda
Slide 4
6. Git has sprung up in many organizations. Spreading like
a wild fire from the development groups.
â Developers want less restrictions to their productivity
â SCM is always seen as a restriction and rarely a necessary one
SCM admins are finding they need to support Git
regardless of existing corporate standards.
SCM admins need to find a way to control the chaos.
Most commercial SCM tools now support Git as a client.
Donât panic Git is fun, powerful and it is the future.
Subversion & Git Presentation
Wait.. What? how did this happen
Slide 6
7. DVCS
â Learn the difference
Users
â Training
â Indulging the Git promoter(s)
Many solutions to common problems
â Authentication
â Workflows
â Multiple available UIs
Cleaning up after user mistakes
Subversion & Git Presentation
What am I in for?
Slide 7
8. 1. RTFM http://git-scm.com/book
2. Now that you read the Git book, go thru these tutorials
3. Watch these videos - Google Tech Talks
Linus Torvalds on git
Randal Schwartz on Git
4. RTFW
https://git.wiki.kernel.org/index.php/Main_Page
5. Create a repo and start playing!
Subversion & Git Presentation
How I learned Git
Slide 8
9. Tutorials
http://try.github.io/levels/1/challenges/1 Code School
https://www.atlassian.com/git/tutorial/git-basics Atlassian's Git tutorial
http://gitready.com/ Git Ready
https://www.kernel.org/pub/software/scm/git/docs/everyday.html
Everyday GIT With 20 Commands Or So
Videos - Google Tech Talks
http://www.youtube.com/watch?v=4XpnKHJAok8 Linus Torvalds
http://www.youtube.com/watch?v=8dhZ9BXQgc4 Randal Schwartz
Wiki
https://git.wiki.kernel.org/index.php/GitCommunity|Git Community Wiki
Subversion & Git Presentation
Resources
Slide 9
11. When coming from another SCM system to Git you need
to shift how you think about how version control works.
In a more classic SCM you think of it as a system that
versions files in a tree or directory structure.
Git is better thought of as a system that versions trees of
files.
Biggest Obstacle
12. Stores whole copies of the repo
â No file deltas
â Entire tree is captured at each commit not just the files that
changed, a snapshot of the repo
Branches and tags
â Are pointers to commits
â Very fast and light weight
Subversion & Git Presentation
How Git Works
Slide 12
13. Git is:
â Powerful
â Complex
â Fast (local)
â worthy contender to replace many commercial tools
â the solution you are looking for
Object Storage
â Blobs
â SHA1s or hashes
â Trees
Perl like syntax
â ^ $ ~ âŠ
Subversion & Git Presentation
Not Scared yet?
Slide 13
15. Centralized
â Central repository
Feature Branch
â Central repository + branching per features
Gitflow
â Branches per features, releases and bug fixes
Forking
â Distributed workflow
Workflows
16. Uses a central repository
â single point-of-entry for all changes
â Everyone clones from the central repo
â Everyone pull/pushes from the same repo
Benefits
â SCM Admin can put controls/triggers on the central repo
â Security can be setup using tools like
âą Stash
âą Gitolite
âą Gitosis
â SCM Builds and Deploys can be maintained from a clone of the
central repo.
Centralized
17. Development of features in isolated branches
â Allows features to be developed independently
As a feature is finished it is merged to the master branch
Subversion & Git Presentation
Feature Branch
Slide 17
18. Branches are focused around releases
Branches are also used for
â Release
â Integration or Test
â Features
Strict rules on how and when branches interact
Subversion & Git Presentation
Gitflow
Slide 18
19. Repos are forked per developer
â Developers work in isolation
One Repo is declared as the Official Repo
â A Project Maintainer integrates the Repos
â Developers sync with the Official Repo
Subversion & Git Presentation
Forking
Slide 19
21. What to Migrate? Snapshot in time or all history?
â Push for converting a snapshot in time
â If that fails, then try for a few key slices
â Arguments
âą Why burden the new repo with all the history
âą Populating new workspaces will take longer
âą Leave old SCM system in a locked down state for reference
â Refactoring
âą Always a good time to refactor when switching SCM system
âą Can cause headaches if under deadlines
â Builds
âą How dependent were you on the old SCM for builds
â Paths
â Build tools (e.g. clearmake)
â APIs, Libs
Migration Considerations
22. Client and Server concepts
Use a Client side hook for actions
â Commit
â Merge
â Rebase
Server Hooks
â Notification
â Rejecting Pushes
Hooks need to be copied to the repos
â Hooks are not part of cloning
â Hooks do not get updated with pull/pushes
In general, use hooks in Git to encourage workflow or for
notifications. Do not rely on them to enforce security
Subversion & Git Presentation
Hooks
Slide 22
23. Be Clever
â There is no one way to provide Security
â There is no single definition of Security
SSH keys
Git Repository Management
â Stash
â Gitolite
â Github
Triggers
Subversion & Git Presentation
Security
Slide 23
24. Sometimes a user removed something they didnât mean
to.
The following commands are your friends when trying to
figure out what to restore and from where.
â Git log
â Git relog
â Git reset
â Git update-ref
Repos for backups
â Create clones on a safe network disk
â Pull to them once a day (or once a week)
â Use them to recover files or as a reference
Subversion & Git Presentation
Recovering files
Slide 24
26. Builds failed after migrating a project from ClearCase to
Git
â Dev group certain the migration to Git had failed
â Build depended on a large number of sub directories to exist
â Git does not add empty directories
âą It needs a blob to point to a directory for the directory to exist.
â Solution was to initially add the missing directories
âą Created .temp files in each empty dir
âą This creates a blob and the directory is added to Git
â Long term solution
âą Encourage them to fix their build Ant/Make files.
Empty Directories
27. A user added multiple large files to his repo
â Then committed them and pushed them to the central repo
User removed them with âgit rm ârfâ
Why is this bad?
â Clone commands went from seconds to 20 minutes
Why?
â Git didnât remove the large files from the initial commit
â Clone copies the entire repo locally, those files while no longer
visible are still copied
Solution
â Git filter-branch
â Git gc
â Git prune
Subversion & Git Presentation
Slow Clones
Slide 27
28. Client Requirements
â Contractors limited to sub dirs.
â All files in a single Repo.
Git by design
â Does not preserve directory permissions
â Hooks run before or after a Git command
â Submodules donât offer additional protections
âą Also broke the client single repo requirement
Subversion & Git Presentation
Directory Isolation
Slide 28
29. Client workflow depended on Tags
Git Tags are not shared by default
â Tags need to be explicitly;
âą Pushed to the remote
âą Pulled locally
Solutions
â Reevaluate Workflow
â Share pull command with Tag name
â Share Hash
Subversion & Git Presentation
Universal Tags
Slide 29
30. Client wanted to control who could create a local repo
â Git is not designed to do this
You can limit who can clone from a central Repo
â Stash/Gitolite
â SSH Keys
Once a Repo is cloned
â Nothing is stopping the user from cloning it again
â They can allow others to clone
Solution
â Lock down who can push back to the central Repo
Subversion & Git Presentation
Controlling local repos
Slide 30
31. Client wants to Clone one subdir of a Repo
â Build requires entire Repo
â Deploy requires one sub dir
â Build happens weeks before the deploy
â Deploy wants a fresh Repo
âą Just build results and deployment script
Solution
â Submodules
Subversion & Git Presentation
Partial Clone
Slide 31