Question about remote clone
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- docker, git, rust
- Lĩnh vực
- networking
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện thao tác clone qua SSH với ví dụ Rust, docker-compose.yml và Dockerfile, sau đó kiểm tra lỗi libssh2 remote.c đã được báo cáo. So sánh đường đi Rust/libgit2 với đường đi Git đang hoạt động trong terminal và xác định liệu vấn đề nằm ở thiết lập SSH của container hay ở dependency; hoàn tất có nghĩa là có chẩn đoán tái hiện được và hướng giải quyết có thể thực hiện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Overview
The provided documentation for cloning with an SSH key closely follows the code below. I keep getting an authentication error even after trying most of the closed-issue solutions in this repository. I suspect that the error is coming from libssh2 dependency because when I trace the bug it appears to be erroring out in remote.c.
The SSH key does work with the environment because it clones properly when using git in terminal
Error
Failed to clone: failed to start SSH session: Unable to exchange encryption keys; class=Ssh (23) 😡
Code
Rust Code
use git2::{build::RepoBuilder, Cred, Error, FetchOptions, RemoteCallbacks, Repository};
use std::env;
use std::path::Path;
fn main() {
let url = "ssh://git@localhost:2222/home/git/repos/test.git";
let path = Path::new("./test");
let mut callbacks = RemoteCallbacks::new();
callbacks.credentials(|_url, username_from_url, _allowed_types| {
Cred::ssh_key(
username_from_url.unwrap(),
None,
std::path::Path::new(&format!("{}/.ssh/id_rsa", env::var("HOME").unwrap())),
None,
)
});
let mut fetch_options = FetchOptions::new();
fetch_options.remote_callbacks(callbacks);
let mut builder = RepoBuilder::new();
builder.fetch_options(fetch_options);
match builder.clone(&url, &path) {
Ok(repo) => println!("Successfully cloned into {}", repo.path().display()),
Err(e) => println!("Failed to clone: {}", e),
}
}
Enviroment
- Client (Me): Windows 11
- Git Server: Docker Container with ubuntu (see docker-compose below)
docker-compose.yml
services:
git-server:
build: .
ports:
- "2222:22"
volumes:
- ./ssh:/home/git/.ssh
dockerfile
FROM ubuntu:latest
# Update and install git and openssh-server
# Create the directory for the sshd server
RUN apt-get update && \
apt-get install -y git openssh-server && \
mkdir /var/run/sshd
# Switch to the git user and create the .ssh directory with git user permissions
RUN useradd -m git && \
su git -c "mkdir -p ~/.ssh && chmod 700 ~/.ssh && touch ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
# ⚠️ Must add the ssh key to the authorized_keys file see read me for more
RUN chmod 700 /home/git/.ssh && \
chmod 600 /home/git/.ssh/authorized_keys
RUN chown -R git:git /home/git/.ssh
# Create a folder for the git repositories
RUN su git -c "mkdir /home/git/repos"
# Create a test repository
RUN su git -c "cd /home/git/repos && git init --bare test.git"
# Expose the ssh port
EXPOSE 22
# Start the sshd server
CMD ["/usr/sbin/sshd", "-D"]
SSH key creation
ssh-keygen -t rsa -b 4096 -C "[email protected]"
I then put this key in the mount .ssh folder and put it in a file called authorized_keys.
Final Remark
I am just trying to get a test environment for a server set up so I can test it with my actual application. If anyone has an alternative approach.
- Ngôn ngữ chính
- Rust
- Star
- 2.1k
- Fork
- 470
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 18
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rust-lang/git2-rs
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`stash_foreach` crashes on stash entries with no message or a non-UTF-8 messageCó thể đã có người làm @shivampwm2020 đã nhận 43 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rust-lang/git2-rs
Issue tương tự
-
bug P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Windows microphone listing treats words in a device name as DirectShow labelsCó thể đã có người làm @Sujal-chaudhary đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
clipy-recorder/clipy#447 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
nightly-cleanup
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
max-sixty/worktrunk#4939 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursĐang mởflaky
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
stacks-network/stacks-core#7918 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày