repo

Switching code to a mirrored repo

Let say you mirror your repository from gitlab to github or vs versa. You can re-clone your code from the new place.

But there is a better and faster way. First it is good idea to view your current config …

git remote -v

Then to do the change do something like this :

git remote set-url origin git@new_repo.com/something/blah.git

Now check if it changed :

git remote -v

Start local repository

You should always put your code under version control.
Here is recipe how you start a repo with your project on your local machine. Easy peasy … so you have no excuse not to do it.

  • /repo : is the directory where you keep your repositories
  • /work : is your workspace directory
  • blah : is the name of the repo you are creating
cd /repos
mkdir blah.git
cd blah.git
git init --bare
cd ..
cd /work
git clone /repos/blah.git
cd blah
> readme.txt
git add readme.txt
git commit -m 'start ...' -a
git push