User 17670
User 17670

Reputation: 243

Where is my git folder?

I have a folder on Mac1 (the name of a computer I'll be using) called "git" and in it is an ongoing project that I can 'pull'. This folder is at MacintoshHD>Users>MyName>git>ProjectName

I now want to have the same on Mac2 (another computer). This is what I've done so far on Mac2 (with noob skills):

  1. Installed git by typing sudo port install git-core +svn +doc +bash_completion +gitweb into Terminal after having already installed MacPorts.

  2. Did git config --global user.name "John Doe" and git config --global user.email [email protected], using the same settings as those on Mac1.

Now, I'd like to 'pull' the the latest version of the project folder ProjectName onto Mac2. If I was on Mac1, I'd just cd to MacintoshHD>Users>MyName>git>ProjectName and run git pull. However, I don't have this "git" folder in the same directory on Mac2.

What should I do?

Upvotes: 1

Views: 7390

Answers (1)

Gabriele Petronella
Gabriele Petronella

Reputation: 108169

You need to push the local repository to some remote host, like GitHub. Then on any other machine you can get a copy of the repo by using git clone

git clone SomeName@SomeAddress:ProjectName

This will fetch the repository from the remote URL and clone it into your other computer.

To recap

On Mac1

git push //This will synchronize the local repo with the remote one

On Mac2

mkdir -p /Users/MyName/git // Optional, create a folder named git
cd /Users/MyName/git // Go into that folder
git clone SomeName@SomeAddress:ProjectName // this will create a local copy of the repo

You will end up with a git repository inside /Users/MyName/git/ProjectName. From now on you can push/pull within it.

Upvotes: 3

Related Questions