-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from SSH #1635
Comments
You have multiple choice :
There must also be others methods to do it but they should be the easy one. |
@sapk : Thanks for your tips, but I already tried the Migrate form in Gitea, it does not accept SSH url's. |
Have you try replacing ssh:// url part with git:// ? |
@RickZeeland how many repos do you want to transfer over? What you could do is just clone them and push them to your Gitea server git clone [email protected]:abc/123.git
cd 123
git remote set-url origin [email protected]:org/repo.git
git push origin master
git push --tags The |
@sapk : Thanks, I will try that out first next week when I'm at work again. @deanpcmad : Looks good, It's only for one big repo. I tried something like you suggested locally with drive paths but got an error when pushing, had to go through some hoops to get it working: |
@sapk : Nope, git: does not work. |
@hetykai I have not read anywhere that this has been fixed, so I'm afraid you will have to do it from Bash with GIT commands like shown above.
|
@hetykai it could also have to do with the SSH configuration which is typically found in: C:\Projects\Gitea\custom\conf\app.ini How to config SSH settings
|
Any updates on this one? I've configured the SSH key on my user profile, but it doesn't seem to work properly with a git url. ie
|
@pgodwin as of now HTTP(S) is still the only way to mirror/migrate git repos from other systems |
I'm confused, is this a conversation of the git:// URL prefix or not? If not, let me know so I can start an issue. Currently getting unable to connect and connection timed out |
@BNolet No this is not a conversation of the git:// URL prefix. Don't think anything has changed and it's still not possible to migrate from SSH in Gitea, the documentation at https://docs.gitea.io/en-us/ only mentions: "Clone with SSH/HTTP/HTTPS". |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
Still an issue |
Hey, I'm seeing this as well, I think that it mostly has to do with being unable to specify a key to clone with, as if you import from an https:// link initially, and then edit the upstream url afterwards, it allows you to change it to an ssh:// link, but it gets permissions denied. |
what is the current state? |
Noone is currently working on this |
it also confuse me |
This is blocking evaluating Gitea for work. We cannot import our repo which is SSH+Keys only. The fact file:/// is also blocked seems silly to me. Basically we have no path to migrate. |
We'd really like to be able to do this also. We have a bunch of repos where the primaries are on various servers, and we'd like a mirror in Gitea. I'm not sure why this is blocked by #12065 because it should work just fine if the user running Gitea can SSH to the remote servers where the repos are mirrored from (using an SSH key without password - no configuration required in Gitea at all). |
Was just curious, and just had a go at hacking Gitea to support mirroring using password-less SSH. And it worked! The trouble is, I don't know much (or anything) about Go, so I mainly just commented stuff out that prevented the URL from being accepted until Gitea just went ahead and treated it as a plain Git migration. And that does work! |
@zeripath It seems allowing SSH has similar security characteristics as allowing local file repos to be imported/mirrored. So it could be treated in the same way, that is, disabled by default but with a config parameter to allow it. It would help some people (including us) who now have to hack around this limitation using a local file mirror + a cron job to periodically update the local file mirror using SSH :-( |
In fact, looking more closely at the changes needed to support it, it's down to a one line change: to accept the ssh:// as a valid URL, along with http://, https://, and git://. Other than that, of course some text in the UI would need to be updated and some documentation as well. Is there any interest in me creating a patch and push request for this? |
@TheoLassonder feel free to create a pull 👍 |
What about using following workflow to allow SSH key-based authentication for repository migration/mirroring:
|
Since #16437 is closed / merged with this one, I'll try to summarize my thoughts on this feature here. I think it would make sense to split the issue of SSH migration or mirroring into two parts:
If I understand correctly, the first part is what #12397 is about. To be fair, I had not thought about this issue:
However, a) the further comments suggest that there are workarounds to prevent Personally, I don't really see any issue that prevents supporting the Secondly, about the key storage. I don't think entropy is really a problem, since you really wouldn't be generating new keys very often. And unless you're on a tiny embedded platform with a readonly filesystem, even frequent key generation should not be a real problem today. Generating (deploy) keys per repository and storing them in the database should also be reasonable. I haven't looked at the database model yet, and I havent looked at the work in #14483. But you're storing the secret token for Even if you don't want to deal with managing keys on-disk somewhere, you could maybe use Go's crypto/ssh/agent to directly load the private keys from the database into an agent and pass that to the I just stumbled upon this issue earlier today and I have only been using Gitea for a couple days now, so please excuse me if I have overlooked something. But the |
It's a pity that ssh is not supported yet :( |
+1, this option would be nice to have. |
+1, this as well. My company will only allow ssh:// for dealing with repos so being able to mirror push via ssh:// would be beneficial in allowing us to more widely adopt gitea over our internal git-web instance 😢 |
I just hit this issue when trying to setup an SSH mirror to Github. Is there any WIP? I'd be happy to lend a hand |
Since a lot of people seem to be finding this issue, I'll just copy verbatim my workaround from #16437 (comment): I want to mirror a number of repositories to my GitHub account and don't want to create separate keys / tokens for each. So this is how I am currently doing it:
#!/usr/bin/env bash
git push --mirror --quiet [email protected]:username/repository.git &>/dev/null &
echo "GitHub mirror initiated .." Since I had quite a few of those repositories and I also wanted to have the option to skip mirroring on certain pushes, I expanded on the above and saved the following script in #!/usr/bin/env bash
# mirror a repository to github
usage() {
echo "usage:"
echo " $0 username/reponame - mirror to github"
echo " $0 git@hostname:... - custom url"
exit 1
}
mirror() {
echo "mirror to $1 ..."
git push --mirror --quiet "$1"
exit $?
}
# repository argument required
if [[ -z ${1+defined} ]]; then
echo "err: target repository required!"
usage
fi
# check for push options
if [[ -n $GIT_PUSH_OPTION_COUNT ]]; then
i=0
while [[ $i -lt $GIT_PUSH_OPTION_COUNT ]]; do
opt="GIT_PUSH_OPTION_$i"
case "${!opt}" in
skip|skipmirror)
echo "Skip GitHub mirroring ..."; exit 0 ;;
*) : ;;
esac
i=$((i+1))
done
fi
# detect used scheme
# WARN: this is a very simple match ...
if [[ $1 =~ ^git@ ]]; then
mirror "$1"
elif [[ $1 =~ ^[a-z0-9-]+/[a-zA-Z0-9_.-]+$ ]]; then
mirror "[email protected]:$1.git"
else
echo "err: unknown scheme"
usage
fi Use it in a #!/usr/bin/env bash
github-mirror "ansemjo/$GITEA_REPO_NAME" If your Gitea repository has the same name as the GitHub repository, you can just reuse the same snippet, because You can skip mirroring on a push with a
Note that I would still count this as a workaround ... but it has worked reliably for me. |
Thanks @ansemjo! I'll gladly attempt a proper fix, or see if I can take over existing WIP to bring in this feature. Highly motivated now that I'm facing it |
related go-gitea#1635 go-gitea#18159 This will probably be obsolete at some point, but it should not break anything and it may help some users
[x]
):Description
We have a GIT server which only supports SSH for cloning, not HTTP, example:
ssh://[email protected]/source/test.git
How can I migrate a repository in Gitea ?
Or is there some other way I can do this manually ?
The text was updated successfully, but these errors were encountered: