First, create the directory where the new repositorty will be created, then create a bare Git repository.
$ cd /n/Home $ mkdir Demo.git $ cd Demo.git/ $ git init --bare Initialized empty Git repository in n:/Home/Demo.git/Then change back to the local repository location and add a remote repository to your local repository. I'll name mine
backup
, you might want to name it origin
if you don't have any remote repositories yet or potentially something more descriptive if you already have an origin remote repository.$ cd /c/TFS/Demo/ $ git remote add backup /n/Home/Demo.git/Lets check to see that the
backup
remote was added to the local repository.$ git remote backupNow, push your branch to the
backup
remote repository.$ git push backup master Counting objects: 390, done. Delta compression using up to 4 threads. Compressing objects: 100% (378/378), done. Writing objects: 100% (390/390), 4.56 MiB | 4.87 MiB/s, done. Total 390 (delta 255), reused 0 (delta 0) To n:/Home/Demo.git * [new branch] master -> masterThe output will be a bit different every time, but the end result is the same... the files have been pushed to the remote repository.
No comments:
Post a Comment