-1

I cloned a remote repository (from github) locally.

Now I want to push that local repository, to a different remote repository (that already exists). How do I do this?

  • 5
    Possible duplicate of [Git push existing repo to a new and different remote repo server?](https://stackoverflow.com/questions/5181845/git-push-existing-repo-to-a-new-and-different-remote-repo-server) – ash Jan 28 '18 at 18:46
  • Read about [`git remote`](https://git-scm.com/docs/git-remote) and [`git push`](https://git-scm.com/docs/git-push). – axiac Jan 28 '18 at 18:48

1 Answers1

0

I am assuming you're talking about empty repo you have created on your github (usually origin). If it's empty, you can simply:

git push <remote-branch> HEAD

I wrote HEAD even though you're most probably on your local master. The difference is that HEAD is always pushing the branch you're currently on. It can be master or ANY other branch.

Btw, there is amazing book which covers this and much much more advanced topics and best of all - it's free: https://git-scm.com/book/en/v2

Enjoy the learning :)

nemanja
  • 664
  • 5
  • 16