Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Groking git remote usage

Tags:

git

I've been 'playing' with git on my own machine for 6 months now, and really loving it.

However, I'm finding it difficult to really grok how I would use it in a team/enterprisey environment. (I'm wondering whether Eric Sink is right).

I started out trying to install a git server on windows, but that didn't go too well.

So I wondered about just setting up a second repository on my own machine and starting to get a hang on pulling/pushing to that.

Do you know of any good articles for starting 'simple' like that, or do you have any tips on grokking the next level?

like image 936
Benjol Avatar asked May 20 '10 07:05

Benjol


People also ask

How do I change origin remote?

In order to change the URL of a Git remote, you have to use the “git remote set-url” command and specify the name of the remote as well as the new remote URL to be changed. For example, let's say that you want to change the URL of your Git origin remote.

What does git remote add do?

The git remote command lets you create, view, and delete connections to other repositories. Remote connections are more like bookmarks rather than direct links into other repositories.


2 Answers

If:

  • your main computer is accessible through a shared path (\myMainComputer\MySharedDirectory)
  • or you have several repo on the same computer

You simply can:

  • git clone --bare /path/to/your/first/repo
  • cd /path/to/your/first/repo
  • git remote add bare_repo /path/to/bare/rep
  • (work, commits)
  • git push bare_repo
  • (if other have pushed to bare repo as well)
  • git pull bare_repo

In other words, the file protocole is supported as a legitimate URL for remote repos.
See git fetch, section URL:

For local repositories, also supported by git natively, the following syntaxes may be used:

/path/to/repo.git/
file:///path/to/repo.git/
like image 120
VonC Avatar answered Oct 05 '22 17:10

VonC


Try Git Magic, which was the first thing I read when learning Git, and which was great for helping me understand what I was doing -- chapter 3 is all about dealing with more than one repository.

like image 26
Etaoin Avatar answered Oct 05 '22 16:10

Etaoin