blob: 84dd215f736276a3a0d8e1c3b0b9c2e32d16b37e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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)).
|