Cagri
Cagri

Reputation: 727

How can I add another repository in git?

I have a GitHub repository that I push my data in it. I would like to add another remote repository to push my data at the same time.

For example;

git push origin master
git push {another origin} master

Anybody know if it is possible?

Upvotes: 6

Views: 16090

Answers (2)

Ionică Bizău
Ionică Bizău

Reputation: 113485

You have to add another remote:

git remote add another-origin <url>
git push another-origin master

You can replace another-origin with the remote name you want. Also, replace the <url> with your remote url you want to add.

GitHub has a nice guide about this. About working with remotes in general, you can read more here.

Upvotes: 4

Mureinik
Mureinik

Reputation: 312259

You can add an additional remote using the following syntax:

git remote add remotename https://github.com/user/repo.git

You can then push to it (assuming you have the permissions) using:

git push remotename remotebranch

Upvotes: 13

Related Questions