要將變更集推送到Gog,您需要在Gogs上創建一個回購站,然後添加一個使用容器啓動時公開的端口的遠程設備。如果您不確定,請運行以下命令並記下HostPort條目。假設容器名爲gogs:
docker inspect --format "{{json .HostConfig.PortBindings}}" gogs
以下是設置ssh遠程原點的步驟。 使用由3000/tcp的HostPort條目訪問的gogs web ui添加您的公鑰。如果您遵循gogs docker說明,這可能是:http://localhost:10080如果gogs未在本地運行,請將localhost替換爲gogs主機名。
以下主機條目添加到~/.ssh/config
更容易地指定備用SSH端口:
Host gogs
# if gogs is not running locally, add the remote hostname here
Hostname localhost
User git
# the following should match what is listed for HostPort 22/tcp
port 10022
測試與ssh gogs
ssh的主機條目。如果一切正常,你應該看到:
PTY allocation request failed on channel 0
Hi there, You've successfully authenticated, but Gogs does not provide shell access.
If this is unexpected, please log in with password and setup Gogs under another user.
Connection to localhost closed.
添加以下內容作爲遠程:
git remote add origin gogs:yourusername/your-repo.git
注意你與gogs
的ssh主機條目替換[email protected]
。
你現在應該可以推到你的gogs回購。
謝謝!最初有一些配置問題讓我感到沮喪(https://github.com/gogits/gogs/issues/3019),但現在都很好。再次感謝! – Ole
我很高興它幫助! –