简体   繁体   中英

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?

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM