git的安裝和簡單操作
阿新 • • 發佈:2019-02-20
1.註冊一個github帳號。
2.建立一個倉庫。
3.安裝git
sudo apt-get install git
4.建立sshssh-keygen -t rsa -C "your_email"
一路按回車就行了。
完成之後,在~/.ssh資料夾中有兩個檔案,id_rsa和id_rsa.pub,其中id_rsa是私鑰,id_rsa.pub是公鑰。
把id_rsa.pub裡面的東西全部複製下來,然後貼到github的帳號裡。
在account settings/ssh keys/add ssh key,就可以了。
5.測試連線。
ssh -T [email protected]
6.設定username , email出現下面的話就證明連線上了。 Warning: Permanently added the RSA host key for IP address '192.30.252.131' to the list of known hosts. Hi kdqzzxxcc! You've successfully authenticated, but GitHub does not provide shell access.
git config --global user.name "your name"
git config --global user.email "[email protected]"
7.git clone
把程式碼從github上扒下來。
每個倉庫都有個 HTTP clone URL .
直接 get clone HTTP clone URL 就可以了。
比如,
git clone https://github.com/kdqzzxxcc/antry.git
8.git push
把原生代碼上傳。
比如我們已經把antry這個庫扒下來了,現在修改了test.txt裡面的東西,然後要上傳。
cd antry/
vim test.txt
git add .
git commit -m "another"
git push
(輸入帳號密碼就完成了。)
9.git還有很多操作,請自行百度。