Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sync local git repo with new github repository

Tags:

git

github

I have a local git repository hosted in local sever.I would like to add the project to github repository. I would like to keep my local repository as the main repository and github repo as backup repo.

Is it possibly to keep the history(commit history) when I'm adding project to the github?

I would like to "push" every commit to local git repository, so can I sync all the local repo pushes with github repo?

If above two possible, how could I achieve?, If there are link which I could refer?

Udeshika

like image 916
123Ex Avatar asked Oct 20 '25 13:10

123Ex


1 Answers

Seems like you want to push existing git repository to Github

https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/

Create a new github repo, copy its link and add the remote to your local repository.

git remote add origin <remoteRepoUrl>

Then push your local git branch to Github. I am assuming it is master branch.

git push origin master
like image 190
aadarshsg Avatar answered Oct 23 '25 07:10

aadarshsg