Github beginning

1.Register in https://github.com/


2.Set SSH Key

  • Set up ssh key
ssh-keygen -t rsa -C "hans@qq.com"

copy the context of ~/.ssh/id-rsa.pub to github/setting/ssh-key, check ssh.

$ ssh -T git@github.com
Hi tianqixin! You've successfully authenticated, but GitHub does not provide shell access.
  • set up global parameters.
git config --global user.name "Hans"
git config --global user.email "hans@qq.com"

3.Upload your source code

  • Install git in local server
sudo apt-get install git
  • Create your file to upload
touch hello.txt
git add hello.txt

or

git add ./    //add all the files in this directory
  • Check status
git status
  • Commit
git commit -m "hello"
  • Push to remote github
    • Check remote repository
$ git remote
origin
$ git remote -v
origin    git@github.com:tianqixin/runoob-git-test.git (fetch)
origin    git@github.com:tianqixin/runoob-git-test.git (push)

Create or link a remote repository with a name.Generally we set the master as “origin”.

git remote add origin git@github.com:Hans/hello1111111.git
git remote rm origin

Push to github
If you push at first time:

git push -u origin +master 

else if you continue to push:

git push

Sometimes you need below command if you have some new files.
Clone files to from github

git remote add origin https://github.com/Hans/hello1111111.git

4.Download files from github

git clone https://github.com/Hans/hello1111111.git
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值