Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git repoint to new remote repository

Tags:

git

magento2

I run on a Mac OSX. I have pulled down a vagrant box that is compatible with Magento, and then pulled down the Magento 2.0 codebase (develop branch) via git clone, and successfully installed it.

I now have an installed, configured codebase tailored to our company. What I wan to do is:

  1. repoint where my local repo considers "master" or "origin" to exist to our company URL
  2. to a git push (I think that is correct) of the code to this blank repository.

The logic is, now the dev team can pull that into their vagrant box, do a mysql import of the resultant database, and skip the install.

How do I do #1 and #2?

like image 883
Oliver Williams Avatar asked Dec 24 '22 13:12

Oliver Williams


2 Answers

For #1, you can use git remote set-url, like so:

git remote set-url origin https://company.example.com/git/repo/path/

For #2, you can do a few different things. If you only have a master branch to push, simply use git push origin master. If you want to push all branches, you can use git push origin refs/remotes/origin/*:refs/heads/*, which will push every origin-branch that your local Git repository knows about to origin.

like image 100
Mathias Rav Avatar answered Jan 03 '23 01:01

Mathias Rav


git remote set-url origin url/to/company/repo will change what the origin repository URL is. For the second part, you'll first need to initialize a bare repository at that URL, and then you can push to it.

like image 25
Oblomov Avatar answered Jan 03 '23 02:01

Oblomov