我一直在無休止地整個學期。我能夠從我在學校的前一年添加專案,但無法將新專案推送到我的存盤庫。
我嘗試通過我的密鑰訪問鏈洗掉我的密鑰憑據。我創建了一個新的 GitHub 帳戶并嘗試使用該帳戶。我一遍又一遍地從頭開始洗掉存盤庫。
我已閱讀有關問題的問題,并嘗試在此處遵循多個不同的答案。我不會給出什么來理解正在發生的事情以及為什么似乎沒有任何東西可以讓我再推動一個專案。
最近的嘗試是回到我原來的 GitHub 帳戶。我創建了一個全新的存盤庫。我創建了一個新檔案夾并將我的簡單 python 專案復制到其中并保存。
error: remote origin already exists.
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git remote rm origin
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git remote rm upstream
error: No such remote: 'upstream'
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git remote add origin https://github.com/stephanieBrandon/GuessARandomNumberGame.git
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git push -u origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/stephanieBrandon/GuessARandomNumberGame.git'
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % ls -a
. .. guess_a_random_number.py
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /Users/stephaniebrandon/Documents/GitHubPortfolio/Python/GuessARandomNumberGame/pythonGame/.git/
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git remote add origin https://github.com/stephanieBrandon/GuessARandomNumberGame.git
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git push -u origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/stephanieBrandon/GuessARandomNumberGame.git'
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % ls -a
. .. .git guess_a_random_number.py
(base) stephaniebrandon@Stephanies-MacBook-Pro-2 pythonGame % git status
On branch master
我希望我缺少一些簡單的東西,如果有人可以解釋并幫助我,將不勝感激。
uj5u.com熱心網友回復:
Stephanie,您的本地分支名稱是“master”,而不是“main”,正如您從“git status”輸出中看到的那樣。
如果您嘗試“git push origin master”,它應該可以作業。
uj5u.com熱心網友回復:
你沒有主分支,你有主分支。??
嘗試:
git push origin master
uj5u.com熱心網友回復:
在將存盤庫推送到 Github 之前,您需要進行一些提交。
此外,您的本地默認分支名稱是master,因此您必須使用git push -u origin master而不是git push -u origin main
$ ls
guess_a_random_number.py
$ git init
Initialized empty Git repository in /Users/stephaniebrandon/Documents/GitHubPortfolio/Python/GuessARandomNumberGame/pythonGame/.git/
$ git add .
$ git commit -m "initial commit"
$ git remote add origin https://github.com/stephanieBrandon/GuessARandomNumberGame.git
$ git push -u origin master # not main
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/532709.html
標籤:github
上一篇:OracleDBA調度程式流
