The versioning tool Git has long been on my list of things I want to look at me once. Right now I still use subversion . But while you can save with subversion changes only in a central repository that provides decentralized Git repositories that can be merged on demand from a central repository.
But before the first use is to install. Certainly, one can also translate Git from source, but both Linux [1] and for the Mac [2] are there any packages. The first steps in these two German tutorials [3] [4] explained. Is a detailed tutorial is German from Stanford University [5] .
Scenario
My scenario is as follows: - a central repository on my Mac mini (which I used as a server)
- a distributed repository on my Mac mini (if I'm sitting times before)
- a distributed repository on my Ubuntu laptop (with you)
It starts with the project that you want versioned with Git. The terminal is the developer's favorite friend and why the full functionality of Git is addressed only to them (is an Eclipse integration, it also [6] ). But one step at a time.
Step 1: versioning of existing project with Git
First you have to git his name and an email address be known. Git uses this information later in the release comments. config --global user.name "Gero Klinkmann" > Git config - global user.name "Gero Klinkmann"
config --global user.email me @ example.com > Git config - global user.email me@example.com
Then you can be first git repository with git init ersellen. For me it is on the Mac mini, to be built on the next step, the central repository.
~ / workspace / testGroovy > Cd ~ / workspace / test groovy
init > Git init
add . > Git add.
commit > Git commit
The commands speak for themselves. When commit can open the vi editor, so you can add a comment for the current state. The command syntax of the vi is not very intuitive, so by all who know them not, just add the necessary commands to the comment:
- [I] change in the insert mode.
- Leave a comment.
- [Esc] switch to the command mode.
- [: Wq] spoke and exit the vi.
Step 2: Create a centralized git repository
The newly created repository then the repository on the remote Mac. The clone of it is about the argument bare to the central repository on the Mac. ~ / git > Mkdir ~ git /
~ / workspace / testGroovy > Cd ~ / workspace / test groovy
clone --bare .git ~ / git / testGroovy.git > Git clone - bare git ~ / git / testGroovy.git.
Step 3: central Git repository clone
On the Linux laptop is supposed to create a distributed repository. Therefore it is necessary to clone the central repository on the Mac. Both computers are connected via ssh. Furthermore, when cloning the git-upload-pack (and that of the computer, where the central repository is - for me that is the Mac) is required.
To avoid problems, such as bash: git-upload-pack: command not found prevention should be the place (in my case it is / usr / local / git / bin / git-upload-pack) to specify the command to clone.
~ / projekte > Cd ~ projects /
clone --upload-pack / usr / local / git / bin / git-upload-pack \ > Git clone - upload-pack bin / usr / local / git / / git-upload-pack \
username @ server / full / remote / path / to / testGroovy.git testGroovy ssh: / / username @ servername / full / remote / path / to / test testGroovy.git groovy This one does not always pay attention to is this can also be deposited in the git configuration file.
~ / projekte / testGroovy > Cd ~ / projects / groovy test
.git / config > Vi. Git / config
] [Remote "origin"]
:refs / remotes / origin /* fetch = + refs / heads / *: refs / remotes / origin / *
username @ server / full / remote / path / to / testGroovy.git url = ssh: / / username @ servername / full / remote / path / to / testGroovy.git
usr / local / git / bin / git-upload-pack upload pack = / usr / local / git / bin / git-upload-pack
usr / local / git / bin / git-receive-pack receivepack = / usr / local / git / bin / git-receive-pack Step 4: from local to central repository
Changes to the sources are first in the local repository git commit -a versioned. Also in this commit opens the vi editor for a version comment. With git push the changes to the local repositories are communicated to the central repository.
~ / projekte / testGroovy > Cd ~ / projects / groovy test
commit -a > Git commit-a
push > Git push
Step 5: Local and central repository on a server
I had started with a local repository on my Mac. About git clone-bar, an additional central repository was created. But still there is no connection between the two. This is done through an entry in the configuration file of the local Git repositories.
~ / workspace / testGroovy > Cd ~ / workspace / test groovy
.git / config > Vi. Git / config
...
# Connect to the central repository
] [Remote "origin"]
:refs / remotes / origin /* fetch = + refs / heads / *: refs / remotes / origin / *
path / to / git / testGroovy.git url = / full / path / to / git / testGroovy.git
] [Branch "master"]
remote = origin
master merge = refs / heads / master Conclusion:
A little configuration is necessary even if you want to use to speak with both centralized and decentralized Git repositories. For this effort, but you get a very powerful, very stable and fast version control system that does not require a connection to a central repository.
Links:
[1] git-core - Core packages for Ubuntu
[2] git-osx-installer - Google Code Project
[3] German short git tutorial - on interaktionsdesigner.de
[4] German short git tutorial - on-line tutorials.net
[5] detailed German Git Tutorial - Stanford University
[6] EGit - Eclipse plugin for Git
The Git version control tool has long been on my list of things I want to look at me once. Right now I still use subversion. But while you can save with subversion changes only in a central repository that provides decentralized Git repositories that can be merged on demand from a central repository. But before the first use is to install. Certainly, one can also translate Git from source, but both Linux [1] and for the Mac [2] are there any packages. The first steps in these two German tutorials [3] [4] explained. Is a detailed tutorial is German from Stanford University [5]. My scenario is the following scenario: a central repository on my Mac mini (which I used as a server) is a distributed repository on my Mac mini (if I'm sitting times before) a distributed repository on my Ubuntu laptop (you) starts with the project that you want versioned with Git. The terminal is the developer's favorite friend and why the full functionality of Git is addressed only to them (is an Eclipse integration, it also [6]). But one step at a time. Should versioning existing project with Git Git First one's own name and an email address to announce: Step 1. Git uses this information later in the release comments. > Git config - global user.name "Gero Klinkmann"> git config - global user.email me@example.com Then you can ersellen his first Git init repository git. For me it is on the Mac mini, to be built on the next step, the central repository. > Cd ~ / workspace / groovy test> git init> git add. > The git commit commands speak for themselves. Can commit itself at the opening of the vi editor, so you have any comments on the current state. The command syntax of the vi is not very intuitive, so by all who know them not, just add the necessary commands to the comment: [i] change in the insert mode. Leave a comment. [Esc] switch to the command mode. [: Wq] spoke and exit the vi. Step 2: Create the repository is a central Git repository just created, then the remote repository on the Mac. The clone of it is bare of the argument to the central repository on the Mac. .> Mkdir ~ / git> cd ~ / workspace / test groovy> git clone - bare git ~ / git testGroovy.git / Step 3: central Git repository clone on the Linux laptop is supposed to create a distributed repository. Therefore it is necessary to clone the central repository on the Mac. Both computers are connected via ssh. Furthermore, when cloning the git-upload-pack (and that of the computer, where the central repository is - for me that is the Mac) is required. To avoid problems, such as bash: git-upload-pack: command not found prevention should be the place (in my case it is / usr / local / git / bin / git-upload-pack) to specify the command to clone. > Cd ~ / projects> git clone - upload-pack bin / usr / local / git / / git-upload-pack \ ssh :/ / username @ servername / full / remote / path / to / test testGroovy.git This is groovy does not always pay attention to is that you can also deposit in the git configuration file. > Cd ~ / projects / test groovy> vi .git / config [remote "origin"] fetch = + refs / heads / *: refs / remotes / origin / * url = ssh :/ / username @ servername / full / remote / path / to / upload testGroovy.git pack = / usr / local / git / bin / git-upload-pack receivepack = / usr / local / git / bin / git-receive-pack Step 4: from local to central repository changes to the sources be versioned first in the local repository git commit-a. Also in this commit opens the vi editor for a version comment. With git push the changes to the local repositories are communicated to the central repository. > Cd ~ / projects / groovy test> git commit-a> git push Step 5: Local and central repository on a server I had started with a local repository on my Mac. About git clone - bar, an additional central repository created. But still there is no connection between the two. This is done through an entry in the configuration file of the local Git repositories. > Cd ~ / workspace / test groovy> vi .git / config ... # Connect to the central repository [remote "origin"] fetch = + refs / heads / *: refs / remotes / origin / * url = / full / path / to / git / testGroovy.git [branch "master"] remote = origin merge = refs / heads / master Conclusion: A little configuration is necessary even if you want to use to speak with both centralized and decentralized Git repositories. For this effort, but you get a very powerful, very stable and fast version control system that does not require a connection to a central repository. Links: [1] git-core - Core packages for Ubuntu [2] git-osx-installer - Google Code project [3] German short git tutorial - short on interaktionsdesigner.de [4] German Git tutorial - on-line tutorials. net [5] detailed German Git Tutorial - Stanford University [6] EGit - Eclipse plugin for Git
gklinkmann written by \ \ tags: git , kubuntu , macos , tools , tutorial