Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub git remote add origin [email protected]:username/ProjectName a one time process?

Tags:

git

github

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?

like image 270
Sumit M Asok Avatar asked Dec 02 '09 14:12

Sumit M Asok


People also ask

What is git remote add origin?

Git remote add origin: It centralises your source code to the other projects. It is developed based on Linux, complete open source and make your code useful to the other git users. We call it as reference. It pushes your code into the Git repository using remote URL of GitHub.

How do I find my git remote URL?

You can view that origin with the command git remote -v, which will list the URL of the remote repo.


2 Answers

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.

like image 162
jamuraa Avatar answered Sep 19 '22 21:09

jamuraa


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.

like image 29
MBO Avatar answered Sep 22 '22 21:09

MBO