Search code examples
gitgit-push

GIt push from local to local


I am trying to add a second local repo on my local machine. So I created a directory, made a git init there and then I ran : git remote add new_repo /path/.git

Then from my local repo, I ran git push -u mybranch, knowing it is my working branch from where I push, then I get the error :

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.

How can I success push my stuffs on the second repo ?


Solution

  • You have to tell it where to push. git push -u new_repo mybranch will push mybranch locally to mybranch on new_repo (and set up tracking so that in the future, git push will default to pushing mybranch to new_repo).