简体   繁体   中英

How to add remote Git repo to local repo and keep it updated?

I have authorization by public_key to remote repo and I can get everything from http://someurl/first.git on my local machine, but I have to populate this changes to other environments. To make it possible I have to put there my private_key , clone repo and switch to specified tag. But I don't want to do it because of security reasons.

I'm thinking about creation of my local repo http://someurl/second.git , committing all changes to it and deploy. But I have now idea how to add remote repo to my local? Is it possible? And how to commit to my local repo from remote and switch to needed tag?

Noufal Ibrahim should post his comment as an answer :

Use git remote add to register a new remote repository, eg :

git remote add site2 http://someurl/second.git

After that, you can push from your local machine to this other repository :

git push site2 myBranch

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