2015-03-19 158 views
2

我的教授希望我們使用他的github存儲庫作爲他的課程。我創建了ssh密鑰,我將私鑰添加到ssh-agent並將公鑰授給了教授。 後,我創建的項目文件夾,並執行下列步驟:推送到遠程GitHub存儲庫

git init 
git add * 
git commit -m "Initial commit" 
git remote add origin [email protected]:prof_username/repo_name.git 
git push -u origin master 

我得到一個權限被拒絕(錯誤403)。我嘗試了ssh和https url。有什麼問題?

+1

肯定你沒有字面上使用'[email protected]:prof_username/repo_name.git'? – Biffen 2015-03-19 09:19:50

+0

@Biffen我希望這只是爲了隱藏實際的用戶/回購股票名稱。 – Holloway 2015-03-19 09:21:47

+0

@Biffen作爲Trengot說,我改變了真正的用戶/回購名稱的隱私。 – retrobitguy 2015-03-19 09:57:29

回答

0

如果你已經有一個倉庫,你不必初始化它;只要將它複製到本地計算機:

git clone [email protected]:prof_username/repo_name.git 

,你可以設置你的上游:

git branch -u origin/my_branch 

[編輯] ...,檢查重點是幹什麼用的:

ssh -vvv [email protected] 
+0

你說得對,我不需要初始化回購。但問題依然存在。 當我執行推送時的消息是: 錯誤:prof_username/repo_name.git被拒絕給myusername的權限。 致命:無法從遠程存儲庫讀取。 請確保您擁有正確的訪問權限並存在存儲庫。 – retrobitguy 2015-03-19 10:06:28

+0

@retrobitguy克隆版本庫有什麼問題嗎?還是隻有當你試圖推動?也許看看這個:http://stackoverflow.com/questions/13509293/git-fatal-could-not-read-from-remote-repository/20714212#20714212 – 2015-03-19 10:21:51

+0

@LarsNielsen克隆沒有問題。我的問題只是在推動。我會看鏈接。謝謝 – retrobitguy 2015-03-19 10:25:51

相關問題