On Wed, 13 Jun 2012 02:11:51 -0700 (PDT)
Flashman pa...@derwentdata.com wrote:
I have installed Git on my computer, but my projects are saved on a
server (long story as to why but is a legacy thing that I can't
change) can I use Git like that, or do I need to install it on the
server?
Uh... like what?
Do you mean somehow accessing the server's file sysem (exported using
NFS or CIFS or whatever file sharing protocol)?
If so then yes, that is theoretically possible but it's highly
recommended against for any practical use. Sensible objections include:
* Git is super-fast, but this means super-fast when dealing with local
files on a fast storage. By breaking this assumption you deprive
yourself of this advantage Git can give you.
* Working with remote files does have certain inherent problems: NFS
is widely beleived to provide crappy locking (which does not work OK
in certain circumstances). Problems with working over CIFS have been
reported for Git for Windows, and they're unlikely to be dealt with
as this is not a problem for those who are able to fix it.
* You lose that every repository is a backup advantage, too: should
your server's FS trash, you won't have a local repository copy.
Next, if you will decide to go for normal Git workflow (you really
should), you *will* need to have Git on the server: no matter what
transport protocol is used to access the server-side Git instance,
in the end, your local Git process always talks to a Git process
running on the server.
To minimize the required amount of file transfers, I would go for this
solution:
1) Install Git on the server. Verify it works (it can be accessed by
the protocol(s) of your choice, both fetching and pushing works).
2) Create a repository on the server. The server usually hosts the
so-called bare repositories, and adding files to such a repository
requires a bit of extra work as you'll need to use a detached work
tree, but it's doable, see below.
3) After recording an initial commit in the repository, clone it
to your client.
Below is explained how to create an initial commit in a bare repository.
Suppose you have a directory ~/devel/project which you want to turn
into a server-side (bare) Git repo.
1) Create the repo:
$ mkdir ~/devel/project.git cd $_
$ git init --bare
And make Git know where our repo is located:
$ export GIT_DIR=~/devel/project.git
2) Create a directory for the throw-away work tree:
$ mkdir /tmp/worktree cd $_
And make Git know where our work tree is located:
$ export GIT_WORK_TREE=`pwd`
3) Populate it with our project files:
$ cp -R -l ~/devel/project/* .
Then add everythhing:
$ git add .
(Here you'll probably need to tinker with the added files
until you're happy with what will be committed.)
Then commit:
$ git commit -m Initial commit
4) Get rid of the work tree:
$ cd rm -rf $GIT_WORK_TREE
At this point you can return back into your $GIT_DIR and run
`git branch` and `git log` there to see that you have recorded an
initial commit on branch master.
Now on your client you can do
$ git clone ssh://you@git.domain.local/~/devel/project.git
and see your repo cloned into the project directory.
You can repeat this step for any repo you need to create on the server.
--
You received this message because you are subscribed to the Google Groups Git
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/git-users?hl=en.