Git代码管理

-----1st-----

1.登录Git hub账号,找到“New repository"

:New repository --> Repository name "exam " --> Description "基于..... " --> Public --> ... README --> Create repository
【注意】" " 里面的内容由自己编辑,第一个是仓库名,第二个是对这个仓库的描述,要等到输入的name变为绿色,代表这个名字可用才可以创建新的repository

2.配置Git

客户端下载Git后,除了安装路径,点击”next"。

搜索“Git Bash"

1) 

$ ssh-keygen -t rsa -C "xxx@qq.com"

Generating public/private rsa key pair.

Enter file in which to save the key (/c/Users/AliceXing/.ssh/id_rsa):

Created directory '/c/Users/AliceXing/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /c/Users/AliceXing/.ssh/id_rsa

Your public key has been saved in /c/Users/AliceXing/.ssh/id_rsa.pub

The key fingerprint is:

xxx@qq.com

The key's randomart image is:

设置密码,三次都是回车,默认密码,记事本方式打开id_rsa.pub,里面内容是密钥,下面要复制使用。

2) 

打开github网站,配置ssh key
步骤:setting --> SSH and GPG keys --> New SSH key --> Title "ssh key" -> Key " 密钥" --> Add SSH key
【注意】" " 里面的内容由自己编辑,第一个是自定义名字,第二个是1)中复制的密钥,

3)

验证是否配置成功,在git bash输入命令 ssh -T git@github.com,第一次配置会让你输入

yes或者no,此时输入yes即可

AliceXing@DESKTOP-LL3J1Q2 MINGW64 ~ (master)

$ ssh -T git@github.com

The authenticity of host 'github.com (20.205.243.166)' can't be established.

This key is not known by any other names

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.

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

4)配置用户名和邮箱

AliceXing@DESKTOP-LL3J1Q2 MINGW64 ~ (master)

$ git config --global user.name "用户名"

AliceXing@DESKTOP-LL3J1Q2 MINGW64 ~ (master)

$ git config --global user.email "邮箱"

3.托管

1) 随意创建一个文件夹,我取的名字是gittest。 
2) 右击目录,点击 Git Init Here(如果没有这个选项,点击Git Bash Here,在出现的窗口中输入命令git init)。
3)  这时,注意! 计算机一定要设置显示隐藏文件,在创建的文件夹下生成一个管理git仓库的文件夹.git,里面包括所有git操作所需要的文件。
4) 在gittest目录下打开的Git Bash窗口(也就是步骤3打开的窗口)输入命令:git remote add origin git@github.com:xxx/exam.git

AliceXing@DESKTOP-LL3J1Q2 MINGW64 /e/Git (master)
$ git remote add origin git@github.com:AliceSky/gittest.git
error: remote origin already exists.

AliceXing@DESKTOP-LL3J1Q2 MINGW64 /e/Git (master)
$ git remote rm origin

AliceXing@DESKTOP-LL3J1Q2 MINGW64 /e/Git (master)
$ git remote add origin git@github.com:AliceSky/gittest.git
 

注意:"xxx"是你的注册用户名,"exam"是前面创建的仓库名。
5) 同步仓库内容,输入命令:git pull git@github:xxx/exam.git,这时gittest目录下多出两个文件,这是原本在github上的文件。
6).最后就要把我们本地的上传到仓库去了!
(1) 执行增加命令:git add.,add后面的点,表示的是提交所有文件,如果想指定提交文件,可以写文件名。
(2) 执行提交命令:git commit -m, "基于AngularJS考试作业系统",-m后面是提示信息。
(3) 推送:命令 git push git@github.com:xxx/exam.git
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值