git用户配置和连接远程仓库

2019-02-28  本文已影响0人  温暖的纯真

1. 配置用户
git每次提交都会引入用户的name和email信息写进历史记录,以说明是谁提交了更新,首次使用时需要配置用户信息。

$ git config --global user.name "name"
$ git config --global user.email "email"

2. 如果是切换用户,需要管理windows的凭据

3. 填入新的凭据
在Git Bash中连接仓库时,填入新的凭证和密码(首先需要建立远程仓库)

$ git clone 仓库地址https***
//或
$ git remote add origin 仓库地址https***

pull代码

$ git pull origin master

//如果出现fatal: refusing to merge unrelated histories
//被认为是不相关的仓库,可以使用强制pull
$ git pull origin master --allow-unrelated-histories

push本地代码,需要创建忽略文件.gitignore把部分文件排除

$ git add 文件路径
//如果全部 
$ git add .
$ git commit -m '本次提交的说明'
$ git push origin master

参考
https://blog.csdn.net/hhtnan/article/details/82684999

上一篇 下一篇

猜你喜欢

热点阅读