第一次用Github desktop(mac)提交代碼遇到的問題


1.新建代碼倉庫

 

2.生成密鑰

ssh-keygen -C 'your@email.address' -t rsa

3.到根目錄下的.ssh文件夾下找到id_rsa.pub文件,將里面的內容復制到下圖所標的位置

 

4.在Git shell下輸入ssh -T git@github.com測試剛才上傳的公鑰是否正確

正確時會顯示:

Hi "Your Name"! You've successfully authenticated, but GitHub does not provide shell access.

 

5.賦值剛創建的代碼倉庫的地址,把倉庫內容clone到本地

git clone https://github.com/YangXudongJack/JYMenuview.git

 

6.這樣就把代碼clone到了本地,然后找到倉庫文件,把要提交的代碼文件copy到里面

 

7.切到Git shell下輸入命令

git init

git commit -m 'JYMenuview'

git remote add origin https://github.com/YangXudongJack/JYMenuview.git

git push origin master

 

 

(1)如果執行git commit -m 'JYMenuview'報錯提示

On branch master

Your branch is up-to-date with 'origin/master'.

Untracked files:

JYMenuview.xcodeproj/

JYMenuview/

JYMenuviewTests/

JYMenuviewUITests/

nothing added to commit but untracked files present

則執行git add jymenuview.xcodeproj/,把提示的文件都加入到倉庫的管理目錄下

 

(2)如果執行git remote add origin

https://github.com/Flowerowl/stumansys.git

,出現錯誤:

  fatal: remote origin already exists

則執行以下語句:

  git remote rm origin

再往后執行git remote add origin https://github.com/Flowerowl/stumansys.git 即可。

 

(3)在執行git push origin master時,報錯:

  error:failed to push som refs to.......

則執行以下語句:

  git pull origin master

先把遠程服務器github上面的文件拉下來,再push 上去。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM