2013-07-18 32 views
1

我已經安裝了GitLab。假設我將它安裝在/home/myuser/gitlab推送Gitlab回購時ssh連接失敗

  1. 我創建了一個新的項目
  2. 有人告訴我,創造一個回購「測試」我把/home/myuser/gitlab/test
  3. 我加了一些SSH密鑰在/home/myuser/.ssh
  4. 然後我/home/myuser/gitlab/test初始化一個Git回購。
  5. 以下說明中,我添加了一個遠程[email protected]:root/testing.git 但是當我嘗試推,我收到此錯誤信息:
$ git push -u origin master 
ssh: connect to host localhost port 22: Connection refused 
fatal: Could not read from remote repository. 

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

我在OS X安裝GitLab和我有其他的SSH密鑰在/home/myhome/.ssh,我已在/home/myuser/gitlab/.git/config內設置了用戶電子郵件和名稱(並將其設置爲全局測試),並從/home/myuser/gitlab啓動服務器。有誰知道這個錯誤來自哪裏?

如果我跑ssh [email protected],我得到

/home/myhome/.ssh/config line 4: garbage at end of line; "home". 

凡在這個文件我有另一個項目的遠程服務器的一些設置。我認爲這是問題,但我不知道如何解決這個問題。

更新:這是我的~/.git/config文件的內容

Host remote_test_server 
Hostname [email protected]_test_server 
IdentityFile ~/.ssh/id_rsa_stf.pub 
User <your home acct> 
+0

@AloisMahdal是的,我認爲這是一個燙髮問題。我將在運行'ssh -T git @ localhost'時更新我的​​標題 – Newben

回答

1

/home/myhome/.ssh/config線4:垃圾在行尾; 「家」。

這會阻止任何ssh命令正常工作,因爲遠程會話完成寄生回聲。

  • 檢查.profile或其他.rc文件,並查看是否有回聲在那些完成。
    或者至少,使用ssh -T [email protected]進行測試,以禁用任何TTY分配。

  • 還請檢查您的.ssh/config文件的內容,該文件似乎沒有正確格式化。

看到這個example of a config file

User應該用於rmeote服務器上的SSH會話的帳戶的登錄名。
它應該而不是是homedir路徑。

IdentityFile應該引用私有密鑰(~/.ssh/id_rsa_stf),公衆一個!

Hostname應引用遠程服務器'ftp.remote_test_server',而不是user @ remoteServer。

+0

我收到相同的消息:'/home/myhome/.ssh/config第4行:垃圾在行尾; 「home」.' – Newben

+0

@新我編輯了我的答案 – VonC

+0

我已經用'〜/ .ssh/config'文件的內容更新了我的帖子。可以配置多個用戶嗎?順便說一下,什麼意思'用戶<您的家庭acct>'? – Newben