I am a fan of using GitHub as my project file repository. But it interest me more if I am able to create a repository on this computer on a different directory path. Then clone that create repository on my new working directory.
I was planning to make a GitHub locally. I've been searching about this and many return that I should use gitolite and many more instead. The problem I am using Windows and I want to do all the steps using command line.
What command lines should I enter to create a repository on a different directory other than the working directory and be able to clone that repository to other terminals within the local network.
LINKING TERMINAL to Windows Host
I have created a repository directory pathed to Users\username\GIT\project.git
.
I am trying to link my terminal using the command line git clone file://{IPv4 server address}/Users/username/GIT/project.git
returns
fatal: '/{IPv4 server address}/Users/username/GIT/project.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
How can I resolve this? I my host is running on Windows 7 and my connecting terminal(s) will be using Ubuntu 12.04 LTS and MacOS Mavericks.
UPDATE TRACK
As the git repository is contained inside your work directory, just place the work directories wherever is most convenient.
A Git repository is the . git/ folder inside a project. This repository tracks all changes made to files in your project, building a history over time. Meaning, if you delete the . git/ folder, then you delete your project's history.
Maybe you're asking simple way to create git repo and local clone ?
git init --bare
git clone --local /path/your/local/repo/
For local network, windows share or other file share may work.
But, the simple way just work, not best or suitable way. there aren't pull request, issue track, privilege control feature on GitHub. For manage git commit or other complicated work, you need a manage system, such as gitolite, gerrit, some may not work on windows system.
If you only need a free private repo, you an use bitbucket.
Clone from windows share:
git clone file:////{IPv4 server address}/share_name/path_to_your_.git_dir
On host computer, you must share repo dir with a 'share_name', eg: parent dir of repo.git
See:
If I read your problem statement correctly, You can simply clone a local git repo into another folder by using the --local
switch on the clone command like this
git clone --local /git/source_repo/project /home/username/workdir/project
where
/git/source_repo/project
is the safe copy of the repo (call it your personal GitHub
if you like).
and
/home/username/workdir/project
is your working folder. It can be any folder where you want to make frequent commits
Switches explained:
--local
When the repository to clone from is on a local machine, this flag bypasses the normal "git aware" transport mechanism and clones the repository by making a copy of HEAD and everything under objects and refs directories. The files under .git/objects/ directory are hardlinked to save space when possible.
If the repository is specified as a local path (e.g., /path/to/repo), this is the default, and --local is essentially a no-op. If the repository is specified as a URL, then this flag is ignored (and we never use the local optimizations). Specifying --no-local will override the default when /path/to/repo is given, using the regular git transport instead.
To force copying instead of hardlinking (which may be desirable if you are trying to make a back-up of your repository), but still avoid the usual "git aware" transport mechanism, --no-hardlinks can be used.
--no-hardlinks
Optimize the cloning process from a repository on a local filesystem by copying files under .git/objects directory.
see documentation for more details
Update 1:
For setting up a Git Server on Windows, you can try this commercial
(open source) software called GitStack.
Useful GitStack resources:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With