$ sudo apt-get install git git-core
$ git config --global user.name "abcd" $ git config --global user.email abcd@efgh.com
$ ssh-keygen -t rsa -C "abcd@efgh.com" //邮箱同上
vim /home/linx/.ssh/id_rsa.pub //复制里面的密钥
$ ssh git@github.com //正常状况下,回显以下 PTY allocation request failed on channel 0 Hi plinx! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed.
$ mkdir tmp //建立推送目录 $ cd tmp //进入推送目录 $ git init //设置该目录为推送 $ touch README //生成readme $ git add README //加入修改列表 $ git commit -m 'first commit' //递交修改声明 $ git remote add origin git@github.com:abcd/tmp.git //为远程Git改名为origin $ git push -u origin master //推送这次修改
ERROR: Repository not found.这个问题是由于在你推送的github帐户中,并无这个Repository。
Agent admitted failure to sign using the key. Permission denied (publickey)这个问题是由于你的ssh key并无加入到你想git的github帐户的ssh key中,因此没有访问权限。
//出现以下提示 ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to ...
$ git push -f
$ git pull
[branch "master"] remote = origin merge = refs/heads/master
$ git config branch.master.remote origin $ git config branch.master.merge ref/heads/master
一、先查看当前开发分支
python
$ cat .git/HEAD ref: refs/heads/master
$ git status # On branch master nothing to commit (working directory clean)
$ git add README //以后有两种方法填写推送信息 //比较简单的一种,直接写入推送信息,-m 就是 message 的意思 $ git commit -m 'message you want to write.' //比较麻烦的一种 $ git commit //进入GNU nano编辑器,底行有操做提示
[master bc30d5d] updated the status. 1 file changed, 1 insertion(+)
# On branch master # Your branch is ahead of 'origin/master' by 1 commit. # nothing to commit (working directory clean)
$ git log
$ git diff //这项操做时要在添加推送以前执行的,不然就看不出哪里不一样了
git branch test0.1 //建立一个test0.1分支 git checkout test0.1 //进入这个分支中来 git branch //查看当前分支状况,所在分支前面有'*'号 git add -A //将本次修改的全部内容都加入修改列表 git commit -m "commit all" //提交说明 git push -u origin test0.1 //将这次修改提交到分支test0.1中去
$ git commit -a $ git push -u origin code_ver0.1 //分支和帐户请勿对号入座