linux命令行下载github文件,Linux命令行下使用GitHub
Linux命令行下使用GitHub
1.注冊github賬號
2.創建ssh密鑰
cd ~
ssh-keygen -t rsa -C your_email@example.com
1
2
cd~
ssh-keygen-trsa-Cyour_email@example.com
會在~/.ssh/下生成id_rsa.pub文件,在github網站上的SSH and GPG keys —>New SSH Keys,標題隨便寫,可以寫計算機的名字,將id_rsa.pub里面的內容粘貼key里,最后點擊Add SSH Key。
3.打開終端
ssh -T git@github.com
1
ssh-Tgit@github.com
這一步如果提示Permission denied (publickey),就執行ssh-keygen -t rsa -b 4096 -C "your_email@example.com"重新產生key,出現一下提示,說明以正常連接到github
Hi ganchunsheng! You've successfully authenticated, but GitHub does not provide shell access.
1
Higanchunsheng!You'vesuccessfullyauthenticated,butGitHubdoesnotprovideshellaccess.
4.在github上創建倉庫
上傳代碼按照這個步驟:
git init #初始化
git add . #初始化本地倉庫
git commit -m "first commit" #加注釋,并提交到本地倉庫
git remote add origin https://github.com/xxxx/test.git #連接遠程倉庫
git push -u origin master #將本地倉庫的東西提交到master分支下
1
2
3
4
5
gitinit#初始化
gitadd.#初始化本地倉庫
gitcommit-m"first commit"#加注釋,并提交到本地倉庫
gitremoteaddoriginhttps://github.com/xxxx/test.git #連接遠程倉庫
gitpush-uoriginmaster#將本地倉庫的東西提交到master分支下
5.下載代碼
master分支:
git clone https://github.com/xxxx/test.git #xxxx為用戶名
1
gitclonehttps://github.com/xxxx/test.git #xxxx為用戶名
包含子分支:
git clone --recursive https://github.com/xxxx/test.git
1
gitclone--recursivehttps://github.com/xxxx/test.git
6.常見問題
(1)提示錯誤:fatal: remote origin already exists.解決辦法:
git remote rm origin
1
gitremotermorigin
(2)git未初始化
***Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
1
2
3
4
***Pleasetellmewhoyouare.
Run
gitconfig--globaluser.email"you@example.com"
gitconfig--globaluser.name"Your Name"
解決辦法:
git config --global user.name "your_email"
config --global user.email your_email@example.com
1
2
gitconfig--globaluser.name"your_email"
config--globaluser.emailyour_email@example.com
總結
以上是生活随笔為你收集整理的linux命令行下载github文件,Linux命令行下使用GitHub的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 电商小编问:16GB内存够吗?别错过这些
- 下一篇: 电脑维修师傅亲身经历:内存条ddr4测电