Skip to content
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

ssh 的链接地址不可以使用 #545

Closed
DrayChou opened this issue Oct 10, 2014 · 30 comments
Closed

ssh 的链接地址不可以使用 #545

DrayChou opened this issue Oct 10, 2014 · 30 comments

Comments

@DrayChou
Copy link

ssh 的地址显示的为:
git@192.168.0.135:gdop/client_bin.git ,
但实际应该是
git@192.168.0.135:gogs-repositories/gdop/client_bin.git ,
而且 必须要输入 git 用户的密码,而不是 gogs 的用户名密码,请问这个要怎么修改下呢?

谢谢

@unknwon
Copy link
Member

unknwon commented Oct 10, 2014

http://gogs.io/docs/intro/troubleshooting.html#git please troubleshooting first.

@unknwon unknwon closed this as completed Oct 11, 2014
@DrayChou
Copy link
Author

文档里没找到相关的说明才跑过来开 issues 的。
也没找到哪里可以设置。

@unknwon
Copy link
Member

unknwon commented Oct 11, 2014

Causes: there are duplicated SSH keys in ~/.ssh/authorized_keys file, possibly you are/were using GitLab for same system user. Check this one.

@DrayChou
Copy link
Author

提示信息是这个:
git.exe clone --progress -v "git@192.168.0.135:gdop/client_bin.git" "E:\新建文件夹\client_bin"

Cloning into 'E:\新建文件夹\client_bin...
fatal: 'gdop/server.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

跟文档里面说的不一样。

@unknwon
Copy link
Member

unknwon commented Oct 11, 2014

Check your ~/.ssh/authorized_keys see if it contains duplicated SSH keys

@unknwon
Copy link
Member

unknwon commented Oct 11, 2014

Error:
fatal: 'XX/XX.git' does not appear to be a git repository
Pushed commits but still shows as a bare repository
Causes: there are duplicated SSH keys in ~/.ssh/authorized_keys file, possibly you are/were using GitLab for same system user.
Solution: delete the old one and keep the one that was added by Gogs only.

@DrayChou
Copy link
Author

~/.ssh/authorized_keys 检查过,没有重复的 keys 。
貌似出问题的表现不是你说的这个吧?

@unknwon
Copy link
Member

unknwon commented Oct 11, 2014

fatal: 'gdop/server.git' does not appear to be a git repository This is your error.

@DrayChou
Copy link
Author

对的,就是问题。事实上访问目录应该是 gogs-repositories/gdop/server.git 而不是 'gdop/server.git'
怎么在 站点上面显示的 ssh 地址前面加上目录名?

另,是不是所有的 SSH 都要用 git 用户去访问?也只能用 git 用户去访问?

@unknwon
Copy link
Member

unknwon commented Oct 11, 2014

What is your REPO_ROOT_PATH value?

另,是不是所有的 SSH 都要用 git 用户去访问?也只能用 git 用户去访问?

Right, or you can change RUN_USER

@DrayChou
Copy link
Author

没有配这个 REPO_ROOT_PATH ,没有文档说到这个配置项。

ssh 的地址不能使用 gogs 的注册用户访问?

@unknwon
Copy link
Member

unknwon commented Oct 11, 2014

If you didn't config this, how can you get Gogs to run? Did you go through /install page?

@DrayChou
Copy link
Author

是的,通过 install 配置的。

@unknwon
Copy link
Member

unknwon commented Oct 11, 2014

Then you must have REPO_ROOT_PATH in custom/conf/app.ini, check its value.

@DrayChou
Copy link
Author

是这样写吗?
REPO_ROOT_PATH = gogs-repositories
但是加进去重启服务之后 SSH 地址没什么变化的

我的 gogs 版本为: 0.5.0.0913 Beta

@DrayChou
Copy link
Author

另,升级的时候可以覆盖升级吗?

@lunny
Copy link
Contributor

lunny commented Oct 11, 2014

REPO_ROOT_PATH = /home/git/gogs-repositories

@DrayChou
Copy link
Author

@lunny
@unknwon

按照你们的信息修改重启了,但是 ssh 的地址还是 git@192.168.0.135:gdop/server.git 这样

@unknwon
Copy link
Member

unknwon commented Oct 11, 2014

但是加进去重启服务之后 SSH 地址没什么变化的

This does not change SSH clone URL.

另,升级的时候可以覆盖升级吗?

Yes.

And, I think the SSH command does not even redirect command to Gogs, because it's handled by your system. So there must be somewhere config wrong or unexpected.

@DrayChou
Copy link
Author

我是使用二进制的方式安装的,使用的 /install 。


由 Mailbox 送出

On Sun, Oct 12, 2014 at 5:31 AM, 无闻 notifications@github.com wrote:

但是加进去重启服务之后 SSH 地址没什么变化的
This does not change SSH clone URL.
另,升级的时候可以覆盖升级吗?
Yes.

And, I think the SSH command does not even redirect command to Gogs, because it's handled by your system. So there must be somewhere config wrong or unexpected.

Reply to this email directly or view it on GitHub:
#545 (comment)

@DrayChou
Copy link
Author

DrayChou commented Jun 1, 2015

通过 ln-s 建立软连接的方法暂时解决这个问题了

@harry91
Copy link

harry91 commented Aug 11, 2015

I met exactly the same problem. Nothing useful from troubleshooting page :-(

@unknwon
Copy link
Member

unknwon commented Aug 11, 2015

Hi @harry91

I met exactly the same problem. Nothing useful from troubleshooting page :-(

So many people says that and turns out they didn't config SSH server right or manually added public keys to .ssh/authorize_keys file.

@harry91
Copy link

harry91 commented Aug 11, 2015

I haven't modified .ssh/authorize_keys manually. Maybe you can write a wiki about how to generate public/private keys and add public key instead of a simple link to github wiki. I'm still working on it. Clone through HTTP works fine.

@unknwon
Copy link
Member

unknwon commented Aug 11, 2015

Maybe you can write a wiki about how to generate public/private keys and add public key instead of a simple link to github wiki.

SSH key generate process is all the same, and there is a operation on URL /admin allows you to completely rewrite SSH auth file based on Gogs database.

Also, what is the error message you get when you say cannot push or whatever it is?

@harry91
Copy link

harry91 commented Aug 11, 2015

Sorry, I didn't say cannot push. I cannot clone.
Key creating process(under cygwin):
$ ssh-keygen -t rsa -b 4096 -C "330737668@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/Guangyu/.ssh/id_rsa):
/home/Guangyu/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/Guangyu/.ssh/id_rsa.
Your public key has been saved in /home/Guangyu/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:uDeN5Evxqz........wpChyjZLLfhJIk 330737668@qq.com
The key's randomart image is:
+---[RSA 4096]----+
balabala......
| o.oo+.. |
+----[SHA256]-----+

Clone procedure:
Guangyu@GY91 /cygdrive/c/Users/Guangyu/Desktop/abcdefg
$ git clone guangyu@120.26.69.11:gogsadmin/gogo_park.git
Cloning into 'gogo_park'...
guangyu@120.26.69.11's password:
Permission denied, please try again.
guangyu@120.26.69.11's password:
Permission denied, please try again.
guangyu@120.26.69.11's password:
Permission denied (publickey,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

No log from logs under log/ folder or console.

@harry91
Copy link

harry91 commented Aug 11, 2015

I'm checking with the auth.log and there's something wrong inside. I'll give you a feedback later.

@unknwon
Copy link
Member

unknwon commented Aug 11, 2015

Well... based on the error, there are two possible known situations:

  1. You doesn't run Gogs by correct user, e.g. you config as git but actually run as root.
  2. Your .ssh/authorize_keys file permission isn't 0600.

@harry91
Copy link

harry91 commented Aug 11, 2015

Good news~! I've finally solved the problem.
I noticed the error information in /var/log/auth.log. It says " Authentication refused: bad ownership or modes for directory /home/guangyu/.ssh"
So I changed the .ssh/ folder to 0700 and .ssh/authorize_keys to 0600. It works.
Sorry, it was my incorrect configuration. Thank you very much~!

@unknwon
Copy link
Member

unknwon commented Aug 11, 2015

@harry91 no problem, good to hear!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants