用户名和邮箱地址的作用
用户名和邮箱地址是本地git客户端的一个变量,不随git库而改变。
每次commit都会用用户名和邮箱纪录。
github的contributions统计就是按邮箱来统计的。
查看用户名和邮箱地址:
$ git config user.name
$ git config user.email
1
2
3
修改用户名和邮箱地址:
$ git config --global user.name "username"
$ git config --global user.email "email"
————————————————
版权声明:本文为CSDN博主「超级杰哥」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/autoliuweijie/article/details/52230165
git修改全局默认的仓库地址
用git写项目的时候,通过命令git config --list看到git bash中有默认的远程仓库地址。
默认第一个项目给出了https://gitee.com/XXX/Music.git,
如果想再第二个项目中引用git地址,那么运行命令
git remote 查看所有远程仓库, git remote xxx 查看指定远程仓库地址
git remote rm origin 删除全局默认仓库地址
git remote add origin XXX 添加一个项目地址
这样就可以初始化全局的git个人信息
还有修改个人信息的时候
如果你没有初始化过。那么直接:
git config --global user.name "输入你的用户名"
git config --global user.email "输入你的邮箱"
这样就可以初始化了。
如果已经初始化过之后,可以用一下命令再次对初始化进行更改
git config --global --replace-all user.email "输入你的邮箱"
git config --global --replace-all user.name "输入你的用户名"
然后再查看下
git config --list
发现修改成功了
//1.gitgui关联github
https://blog.csdn.net/vipzjyno1/article/details/22098621
//2.gitbash关联github
https://www.cnblogs.com/wx1993/p/6646973.html
https://blog.csdn.net/u010802169/article/details/80490886
//官方使用手册
https://blog.csdn.net/COCOLI_BK/article/details/97921497
//1.错误解答:
git 出现 fatal: refusing to merge unrelated histories 错误
引用
git pull 失败 ,提示:fatal: refusing to merge unrelated histories
其实这个问题是因为 两个 根本不相干的 git 库, 一个是本地库, 一个是远端库, 然后本地要去推送到远端, 远端觉得这个本地库跟自己不相干, 所以告知无法合并
具体的方法, 一个种方法: 是 从远端库拉下来代码 , 本地要加入的代码放到远端库下载到本地的库, 然后提交上去 , 因为这样的话, 你基于的库就是远端的库, 这是一次update了
第二种方法:
使用这个强制的方法
git pull origin master --allow-unrelated-histories
后面加上 --allow-unrelated-histories
, 把两段不相干的 分支进行强行合并
后面再push就可以了 git push gitlab master:init
gitlab是别名 , 使用
Java代码git remote add gitlab ssh://xzh@192.168.1.91:50022/opt/gitrepo/withholdings/WithholdingTransaction
master是本地的branch名字
init是远端要推送的branch名字
本地必须要先add ,commit完了 才能推上去
关于这个问题,可以参考http://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories。
在进行git pull 时,添加一个可选项
git pull origin master --allow-unrelated-histories
//2.错误解答
git ------ fatal: No configured push destination. Either specify the URL from the command-line or co
git下载自己项目到本地:
假如外出工作,需要在另一台电脑上面pull自己的某个git远程项目到本地;
git init
git pull https://github.com/TTyb/54qjLogin (远程仓库url)
下载的这个项目更改后需要push的会出现:
$ git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using
git remote add <name> <url>
and then push using the remote name
git push <name>
此时:git remote用法
这个时候第一次push需要网址:
$ git add --all
$ git commit -m "提交信息"
$ git remote add origin '远程仓库url'
$ git push -u origin 对应远程分支名
然后下一次就不用那么麻烦了,直接:
$ git add --all
$ git commit -m "信息"
$ git push
如何在Github中删除已有仓库或文件
本文链接:https://blog.csdn.net/weixin_42152081/article/details/80635777