设置用户信息
git config --global user.name “itcast”
git config --global user.email “hello@itcast.cn”
查看配置信息
git config --list
初始化gi仓库
git init
添加到缓存区
git add a.txt 提加当前文件或文件夹 git add . 提交当前所有文件
日志信息
git commit -m "日志信息"
添加远程仓库
git remote add origin https://gitee.com/camouflage_programmer/code-temple.git
推送到远程仓库
git push -u origin master
gitee推送失败
推送到远程仓库时报错,原因,window默认记住了,你上次提交的用户名和密码
解决:打开电脑的控制面板–>用户账户–>管理Windows凭据
然后删除,gitee的账号信息了。重新提交就行了
remote: WangGang6656: Incorrect username or password (access token)
fatal: Authentication failed for ‘https://gitee.com/camouflage_programmer/code-temple.git/‘
github推送失败
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘https://github.com/WangGang6656/project-01.git‘
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., ‘git pull ...‘) before pushing again.
hint: See the ‘Note about fast-forwards‘ in ‘git push --help‘ for details.
问题原因:远程库与本地库不一致造成的,在hint中也有提示把远程库同步到本地库就可以了。
解决办法:
方法一:使用命令行:
git pull --rebase origin master
该命令的意思是把远程库中的更新合并到(pull=fetch+merge)本地库中,–-rebase的作用是取消掉本地库中刚刚的commit,并把他们接到更新后的版本库之中。
出现如下图执行pull执行成功后,可以成功执行git push origin master操作
方法二:
git push -u github master -f
------------------------即可推送
从远程仓库克隆
git clone https://github.com/gildas-lormeau/JSONView-for-Chrome.git
查看日志记录
git log
查看日志记录
git log
然后我们在磁盘中建立一个本地仓库,然后点击右键会出现GIT Bash Here 选项,点击此选项进行操作面板
我们首先配置当前的用户,使用以下的命令:
git config --global user.name 用户命
git config --global user.password 密码
git config --list 查看当前的配置信息
原文:https://www.cnblogs.com/CodeWang666/p/14680030.html