[git远程操作命令]
1.$ git remote –
v #查看本地配置的所有远程仓库,内容为远程仓库的地址和本地别名
harvey@harvey:~/node$ git remote -v nodejs https://github.com/******/nodejs.git (fetch) nodejs https://github.com/*******/nodejs.git (push)
2.$git remote add test1 http://test1.js #添加地址为http://test1.js 别名为test1的远程仓库
harvey@harvey:~/node$ git remote add test1 http://test1.js harvey@harvey:~/node$ git remote -v nodejs https://github.com/zhanghaiyu/nodejs.git (fetch) nodejs https://github.com/zhanghaiyu/nodejs.git (push) test1 http://test1.js (fetch) test1 http://test1.js (push)
3.$git fetch pb #抓取服务器上的所有别人提交的直接没有的内容
$ git fetch pb remote: Counting objects: 58, done. remote: Compressing objects: 100% (41/41), done. remote: Total 44 (delta 24), reused 1 (delta 0) Unpacking objects: 100% (44/44), done. From git://github.com/paulboone/ticgit * [new branch] master -> pb/master * [new branch] ticgit -> pb/ticgit
4.$ git push origin master #向别名为origin的远程服务仓库推送分支为master的内容
harvey@harvey:~/node$ git push -u origin master Username for 'https://github.com': zhanghaiyu Password for 'https://zhanghaiyu@github.com': Counting objects: 10, done. Delta compression using up to 2 threads. Compressing objects: 100% (8/8), done. Writing objects: 100% (10/10), 972 bytes | 0 bytes/s, done. Total 10 (delta 2), reused 0 (delta 0) To https://github.com/zhanghaiyu/nodejs.git * [new branch] master -> master Branch master set up to track remote branch master from origin.
5.$git remote rename pb paul #把远程服务器的别名pb更改为paul,默认第一个别名是origin
$ git remote rename pb paul
$ git remote
origin
paul
[git配置文件操作命令]
1.git config add user.name z****haiyu #配置给配置文件添加新的属性
harvey@harvey:~/node$ git config core.excludesfile ~/node/.git/info/exclude #添加忽略文件
2.git config --unset core.excludesfile #取消git的参数配置
harvey@harvey:~/node$ git config --unset core.excludesfile
3.git config –list #显示所有的配置
4.git config #查看跟多的config相关操作的命令