Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in DevOps and Agile by (29.3k points)
edited by

Say I have a repository on git.hosted.org and I want to clone this into my account at github to have my own playground aside from the more "official" repo on hosted. What would be the steps to initially copy that over? Within github, there is this nice "fork" button, but I can't use this for obvious reasons.

And how would I track changes in the hosted repo into the github one?

1 Answer

+1 vote
by (50.2k points)

You need to copy the repo to your git-hub and work on it for that follow the steps:

Create a new repository in your github

Then clone the repository which you need to work on from your hosted.org to the local machine

Then rename the repo with upstream using:

git remote rename origin upstream 

Then add your repository url to your remote using: 

git remote add origin <url>

Then push the changes to your remote repo using: 

git push origin master

From the above steps, you can copy repo to your github. 

To get updated and to pull the changes you can do:

git pull upstream master && git push origin master

This will pull the changes and keep you updated with your official repo.

To learn more about Git version control system then you can enroll in Github Training.

Git push to different remote - Git push existing repo to a new and different remote repo server?
Intellipaat-community
by (27.5k points)
Thanks, this was helpful.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...