Moving git repository to another server

I have git clone / repo on the development server, but now I'm moving on to another. I do not want to commit all my local branches and changes to the main repository, so how can I make an exact copy of everything on oldserver on the news server?

I tried oldserver:~$ scp -rp project newserver:~/project

but then I just upload and upload the “changechange” errors when I try to do something on the news server.

Someone said something about x-modes, but how can I save this when moving files between servers?

+3
source share
3 answers

If you need a git solution, you can try

git clone --mirror <oldurl> <newurl>

although this is only for naked repositories.

- , , - :

git fetch origin
git branch -r | grep '^ *origin/[^ ]*$' |
    while read rb; do git branch --no-track ${rb#*/} $rb; done
git remote rm origin

, , 5000 , ! ( , \ bash - ​​, )

, rsync scp (, -avz?), . ( ?)

+4

, , , tar repo up first and scp it over. , scp -rp .

"Typechange" , . ?

+1

- , , git reset:

git reset --hard HEAD

This makes sense only if (1) all the problems relate to the checked files (and not to the structure of the repository itself) and (2) you did not make any changes to the news server that you need to save.

Given these caveats, this worked for me when I came across the same problem, and it does not require you to think about the internal elements of git or how well your file transfer process preserves attributes.

+1
source

Source: https://habr.com/ru/post/1721191/


All Articles