[英]Unable to push git local master to remote repository
我只是想將我的本地主服務器推送到 github 上的遠程存儲庫,但這是不可能的。 我已經在我的 github 目錄中創建了一個存儲庫 - 在網站上,我正在使用的應用程序很簡單,因為我只在本地主機上工作 - 沒有分支或任何東西。
當我在終端中嘗試“git push -u origin master”時,回復是:
permission denied (publickey)
fatal: could not read from remote repository
當我嘗試“git push”時,響應是:
fatal: the current branch master has no upstream branch. To push the
current branch and set the remote as upstream, use 'git push --set-
upstream origin master'
但是當我嘗試“git push --set-upstream origin master”時,我得到:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我已經在網上盡可能多地閱讀了這方面的內容,但我無處可去,所以非常感謝一些建議,謝謝:-)
您可能沒有權限從創建的存儲庫中進行讀取或寫入。 您將需要生成一個新的SSH密鑰,並將公共密鑰添加到您的Github帳戶。 如果您不知道該怎么做, 請參閱https://help.github.com/articles/connecting-to-github-with-ssh/上的詳細說明。
有點晚了,但對於任何其他絆倒這個的人來說,這對我有用。
-如果要更新分支-
git checkout master
git pull origin master
git checkout YOUR-BRANCH
git rebase master
-如果您要提交代碼-
git add -A
git commit -m "any comment"
git push origin YOUR-BRANCH
git checkout master
git pull origin master
git checkout YOUR-BRANCH
git rebase master
最后
git push origin YOUR BRANCH
在您提交合並請求之后
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.