tags:

views:

971

answers:

3

if I have two git projects on my machine with two different ProjectNames

can I manage it with this code in two directories like this

/foo1$ git remote add origin [email protected]:username/ProjectName-1
/foo2$ git remote add origin [email protected]:username/ProjectName-2

Is it getting stored in the directory or in a git config file in system?

+5  A: 

The information is stored in each repository (project), in the .git/config file.

Yes you are doing the right thing by adding the remote to each repository separately.

jamuraa
Thank you jamuraa
Sumit M Asok
+1  A: 

Sure you can. When you create new repository on GitHub it shows help screen how to checkout new project or how to add GitHub as remote:

cd existing_git_repo
git remote add origin [email protected]:username/test.git
git push origin master

Remotes are stored only locally, you can always change them.

MBO
Thank you MBO....
Sumit M Asok
+1  A: 
git remote add remote_name remote_location

remote_name is usually origin in most examples. If you have more than one remote then you will use a different name. For github I usually use "github" instead of origin and have command aliases built around this to make life easier (ie- git config --global alias.pg=push github master). There is also a github ruby gem that provides shortcuts for using github.

remote_location is the url or scp path to the remote repo. Repos using ssh, including private github repos use scp paths in the form of user@host:path/to/repo.git. Github abstracts this out to git@github:username/repo.git. Read only repos use http and are simple urls to the git repo http://host/path/to/repo.git.

Mark Carey