解决git clone时报错:The requested URL returned error: 401 Unauthorized while accessing的问题

版本问题,最直接的解决办法就是重新编辑安装git吧:

1. 下载:

wget -O git.zip https://github.com/git/git/archive/master.zip

2. 解压:

unzip git.zip

3. 进入git目录:

cd git-master

4. 编译安装:

autoconf
./configure --prefix=/usr/local
make && make install

5. 最后别忘了删掉旧的git,并把新版本的git建立软链接到/usr/bin/git

rm /usr/bin/git
ln -s /usr/local/bin/git /usr/bin/git

 

git提示“Pull is not possible because you have unmerged files.”的解决办法(转)

在git pull的过程中,如果有冲突,那么除了冲突的文件之外,其它的文件都会做为staged区的文件保存起来。

重现:

$ git pull

A    Applications/Commerce/BookingAnalysis.java
A    Applications/Commerce/ClickSummaryFormatter.java
M    Applications/CommerceForecasting/forecast/Forecast.java
A    Applications/CommerceForecasting/forecast/ForecastCurveProviderCategory.java
M    Applications/CommerceForecasting/forecast/ForecastProvider.java
M    Applications/CommerceForecasting/forecast/InputPropertyItem.java
……

A    Applications/LocalezeImporter/com/tripadvisor/feeds/SingleMenuLocalezeMatcher.java
A    Applications/LocalezeImporter/com/tripadvisor/feeds/TypeCategory.java

Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use ‘git add/rm <file>’
as appropriate to mark resolution, or use ‘git commit -a’.

通过git status你会发现下面古怪的事情:

zhonghua@pts/ttys000 $ git status
# On branch sns
# Your branch and ‘snsconnect/sns’ have diverged,
# and have 1 and 52 different commit(s) each, respectively.
#
# Changes to be committed:
#
#    new file:   src/config/features_daodao.ini
#    new file:   src/config/services.xml
#    new file:   src/config/svnroot/hooks/mailer.conf
#    new file:   src/config/svnroot/hooks/mailer.py
#    new file:   src/config/svnroot/hooks/post-commit
#    new file:   src/config/svnroot/hooks/pre-commit
#    new file:   src/config/svnroot/hooks/prerelease_notifications.py
#    new file:   src/config/svnroot/hooks/run_checks.py
…….

# Untracked files:
#   (use “git add <file>…” to include in what will be committed)
#
#    _build/
#    css/combined/
#    css/gen/
#    daodao-site.patch
#    daodao-site.patch1
#    js/combined/
#    js/gen/
#    lib/weibo/
#    src/bin/

Pull is not possible because you have unmerged files.

解决:

1.pull会使用git merge导致冲突,需要将冲突的文件resolve掉 git add -u, git commit之后才能成功pull.

2.如果想放弃本地的文件修改,可以使用

git reset –hard FETCH_HEAD

FETCH_HEAD表示上一次成功git pull之后形成的commit点。然后git pull.
注意:

git merge会形成MERGE-HEAD(FETCH-HEAD) 。git push会形成HEAD这样的引用。HEAD代表本地最近成功push后形成的引用。

参考:http://www.ithao123.cn/content-4783203.html

一张图让你彻底理解聚簇索引与普通索引的区别[经典]

mysq_index

下面分析下索引和锁的关系。
1)delete from msg where id=2;

由于id是主键,因此直接锁住整行记录即可。
                                                                               图5
2)delete from msg where token=’ cvs’;

由于token是二级索引,因此首先锁住二级索引(两行),接着会锁住相应主键所对应的记录;
                                                                       图6
3)delete from msg where message=订单号是多少’;

message没有索引,所以走的是全表扫描过滤。这时表上的各个记录都将添加上X锁。
                                                                        图7

强烈推荐阅读:https://yq.aliyun.com/articles/5533

 

mysql配置变量介绍

key_buffer_size

设置这个变量给键缓冲区(或者说键缓存)分配指定大小的空间。但是操作系统只有在实际用到这些空间的时候才会进行分配。例如,将键缓冲区大小设置为1GB,并不意味着服务器就会真正地给它分配1GB空间。

对一个已有的缓存设置非零值将会冲洗缓存,从技术上来说,这是一个在线操作,但是它会阻止所有访问该缓存的动作,直到缓存冲洗完成。

table_cache_size

设置这个变量是不会立即生效,要等到下一个线程打开表的时候才会生效。当它生效的时候,MYSQL会检查变量的值。如果值大于缓存中表的数量,线程就可以把新打开的表插入到缓存中。如果值小于缓存中表的数量,MySQL就会从缓存中删除掉没有使用的表。

thread_cache_size

设置这个变量不会立即生效,生效被延时到了下一次线程关闭的时候。在那时,MySQL检查缓存中是否有空间存储线程。如果是,它会把线程缓存起来,供另外一个连接使用。如果不是,它会直接结束掉线程。在这种情况下,缓存中线程的数量,以及线程缓存使用的内存数量不会立即就下降。只有当新连接为了使用线程把它从缓存中移走的时候才会看到下降。(MySQL只有在连接关闭的时候才会把线程加入缓存,也只有在创建新连接的时候 才从缓存中移除线程。) Continue reading