Git常见错误

fatal: Not a git repository (or any of the parent directories): .git

git init

向github提交分支代码

一开始git remote -v一直都没有显示内容

后来

 git remote add origin git@github.com:mzkmzk/mzkmzk.github.com.git

然后就开始有显示了

K-2:octopress maizhikun$ git remote add origin git@github.com:mzkmzk/mzkmzk.github.com.git
K-2:octopress maizhikun$ git remote -v
origin  git@github.com:mzkmzk/mzkmzk.github.com.git (fetch)
origin  git@github.com:mzkmzk/mzkmzk.github.com.git (push)

尝试提交分支 代码

 K-2:octopress maizhikun$ git push origin source 
error: src refspec source does not match any.
error: failed to push some refs to 'git@github.com:mzkmzk/mzkmzk.github.com.git'

后来先checkout一下 source分支 就ok了

K-2:octopress maizhikun$ git checkout source
Switched to branch 'source'
K-2:octopress maizhikun$ git push origin source

参考链接http://zyueqi.iteye.com/blog/1461466

总结

git init
git remote add origin ssh地址
git add .
git commit -m "first commit"
git branch 分支名称
git checkout 分支名称
git push origin 分支名称

LF will be replaced by CRLF in git

cd到.git路径

git config core.autocrlf true

Error:Untracked files:**

此文件从未commit过

Could not open a connection to your authentication agent

ubuntu@VM-66-109-ubuntu:~$ eval `ssh-agent -s`
Agent pid 1470
ubuntu@VM-66-109-ubuntu:~$ alias ssh-agent-cyg='eval `ssh-agent -s`'
ubuntu@VM-66-109-ubuntu:~$ ssh-agent-cyg
Agent pid 1472
ubuntu@VM-66-109-ubuntu:~$ ssh-add ~/.ssh/test
Identity added: /home/ubuntu/.ssh/test (/home/ubuntu/.ssh/test)
ubuntu@VM-66-109-ubuntu:~$ ssh-add -l
2048 43:6d:47:58:6f:15:57:6a:99:de:f2:58:be:e3:ce:b0 /home/ubuntu/.ssh/test (RSA)

http://stackoverflow.com/questions/17846529/could-not-open-a-connection-to-your-authentication-agent

git

Comments