initial commit
This commit is contained in:
commit
f14e64b82d
5 changed files with 101 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
repos-urls
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 Yann Esposito
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
43
README.md
Normal file
43
README.md
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Point GH users to your new repository place
|
||||||
|
|
||||||
|
:warning: BE SURE TO HAVE A BACKUP OF ALL YOUR REPOSITORIES FIRST :warning:
|
||||||
|
|
||||||
|
You have copied all your GitHub repositories and you want to
|
||||||
|
redirect your user to your new page?
|
||||||
|
|
||||||
|
This is exactly what this repo is for.
|
||||||
|
|
||||||
|
See an example of the result:
|
||||||
|
|
||||||
|
https://github.com/yogsototh/asciimandel
|
||||||
|
|
||||||
|
:warning: These shell scripts were done in a hurry, so use them with care!
|
||||||
|
|
||||||
|
0. Clone this repository and go into it
|
||||||
|
|
||||||
|
1. retrieve all your repositories (NB_PAGES is only mandatory
|
||||||
|
if you have more than 100 repositories)
|
||||||
|
So if you have 281 repositories, you'll need 3 pages to list them all.
|
||||||
|
|
||||||
|
~~~
|
||||||
|
./get-my-repos.sh YOUR_GITHUB_USER_NAME NB_PAGES
|
||||||
|
~~~
|
||||||
|
|
||||||
|
2. One last chance not to overwrite and destroy some repositories.
|
||||||
|
Edit the file `repos-urls` and remove the line which correspond
|
||||||
|
to the repositories you don't wan't to keep on GitHub.
|
||||||
|
|
||||||
|
3. Really start the migration
|
||||||
|
|
||||||
|
~~~
|
||||||
|
./migrate.sh PREFIX_OF_DESTINATIONS
|
||||||
|
~~~
|
||||||
|
|
||||||
|
for example
|
||||||
|
|
||||||
|
~~~
|
||||||
|
./migrate.sh https://gitlab.esy.fun/yogsototh
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Now all thoses repositories in github have been overwritten.
|
||||||
|
And there will be a simple message to tell your user where they'll be able to find it.
|
9
get-my-repos.sh
Executable file
9
get-my-repos.sh
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
GHUSER="${1:-$USER}"
|
||||||
|
NBPAGES="${2:-1}"
|
||||||
|
|
||||||
|
for page in $(seq 1 $NBPAGES); do
|
||||||
|
echo "Retrieving page $page" >&2
|
||||||
|
curl "https://api.github.com/users/$GHUSER/repos?page=${page}&per_page=100" | grep '"ssh_url":' | perl -pe 's#^\s*"ssh_url": "([^"]*)".*$#$1#'
|
||||||
|
done > repos-urls
|
27
migrate.sh
Executable file
27
migrate.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
|
||||||
|
newURL="$1"
|
||||||
|
|
||||||
|
tmpDir="tmp-repo-$$"
|
||||||
|
mkdir $tmpDir
|
||||||
|
cd $tmpDir
|
||||||
|
|
||||||
|
for repoURL in $(< ../repos-urls); do
|
||||||
|
newRepoURL="$newURL/$(echo $repoURL|sed 's#.*/##')"
|
||||||
|
echo $repoURL ' => ' $newRepoURL
|
||||||
|
> README.md << END
|
||||||
|
This repository has moved to $newRepoURL
|
||||||
|
|
||||||
|
migrated with https://gitlab.esy.fun/yogsototh/gh-notify-move
|
||||||
|
END
|
||||||
|
git init
|
||||||
|
git remote add origin $repoURL
|
||||||
|
git add README.md
|
||||||
|
git commit -m "Moved with gh-notify-move"
|
||||||
|
git push -uf origin master
|
||||||
|
rm -rf .git
|
||||||
|
done
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
rm -rf $tmpDir
|
Loading…
Reference in a new issue