summaryrefslogtreecommitdiff
path: root/importing-an-existing-codebase.md
diff options
context:
space:
mode:
Diffstat (limited to 'importing-an-existing-codebase.md')
-rw-r--r--importing-an-existing-codebase.md56
1 files changed, 56 insertions, 0 deletions
diff --git a/importing-an-existing-codebase.md b/importing-an-existing-codebase.md
new file mode 100644
index 0000000..84dd215
--- /dev/null
+++ b/importing-an-existing-codebase.md
@@ -0,0 +1,56 @@
+# Importing an existing codebase
+
+Same repo-creation mechanism as
+[creating-a-repo-from-scratch.md](creating-a-repo-from-scratch.md) — the
+only difference is you already have code and possibly existing git
+history, so you're pointing an existing local repo at gwaihir instead of
+starting from an empty clone.
+
+## Case A: your project is already a git repo
+
+```bash
+cd my-existing-project
+git remote add origin git@git.veltar.systems:personal/bryan/my-existing-project
+git push -u origin --all # pushes every local branch
+git push --tags # if you have tags worth keeping
+```
+
+The first push creates `personal/bryan/my-existing-project` on the
+server, with your full existing history intact.
+
+If the project already has a remote called `origin` pointing elsewhere
+(e.g. GitHub) and you want to keep both, use a different remote name:
+
+```bash
+git remote add gwaihir git@git.veltar.systems:personal/bryan/my-existing-project
+git push -u gwaihir --all
+```
+
+## Case B: your project isn't a git repo yet
+
+```bash
+cd my-existing-project
+git init
+git add .
+git commit -m "Initial import"
+git remote add origin git@git.veltar.systems:personal/bryan/my-existing-project
+git push -u origin master # or main
+```
+
+## Mirroring a repo exactly (all branches, tags, refs, as-is)
+
+If you want a byte-for-byte mirror (e.g. migrating a repo wholesale)
+rather than just pushing your current checkout:
+
+```bash
+git clone --mirror <source-url> my-existing-project.git
+cd my-existing-project.git
+git push --mirror git@git.veltar.systems:personal/bryan/my-existing-project
+```
+
+## After importing
+
+Same as any other repo you create — you own it (`RW+`), you can grant
+others access with `ssh git@git.veltar.systems perms ...` (see the other
+doc), and it's private/SSH-only unless you ask an admin to add it to
+cgit (see [making-a-repo-public.md](making-a-repo-public.md)).