我是一個完全初學者嘗試我的第一個本地到 Github。我已經正確設定了我的 SSH 以使用 Github。我可以做一個
ssh -T [email protected]
并獲取成功資訊。但是,當我最初嘗試將本地檔案移動到新的 Github 存盤庫時,
git remote add origin [email protected]/mygithub/myrepo.git
git push -u origin master
我得到
fatal: '[email protected]/mygithub/omni.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.
我試試標準
git remote add origin https://github.com/mygithub/myrepo.git
它似乎作業但要求我輸入用戶名/密碼,然后不會使用我的常規密碼,但需要一個令牌。顯然,我在使用 no id/pass SSH 方式時遺漏了一些東西。我在 Ubuntu 上并從命令列作業,順便說一句。
uj5u.com熱心網友回復:
URL / URI的語法(有一些簡化)是:
scheme://host/path
或者:
scheme://user@host/path
在scheme這里部分是一個http,https,ssh,等等。所以你可以簡單地寫:
ssh://[email protected]/path/to/repo
代替:
ssh://[email protected]/path/to/repo
(由于 GitHub 處理傳入 ssh 請求的方式,您必須將用戶名git與ssh方案一起使用)。
如果您選擇使用 Git 自己的速記符號:
[email protected]:path/to/repo
請注意,部分:后面有一個冒號 ( ) [email protected]。它不能被消除。
uj5u.com熱心網友回復:
您使用了錯誤的網址。它應該是:
git remote add origin [email protected]:mygithub/myrepo.git
git push -u origin master
請注意,:github.com 和您的用戶名之間有一個,而不是斜線。
另外,在推送之前確保存盤庫存在。如果您還沒有在 github 上創建它,那么您將無法推送它。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/361016.html
上一篇:按目錄分隔gitconfig
