歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> git+github使用

git+github使用

日期:2017/3/1 16:36:27   编辑:關於Linux
git+github使用 1.在github上新建一個Repository,基本信息完成後記下[email protected]:xxx/xxx.git. 2.本地配置 用戶名和郵件配置默認會在 ~/.gitconfig www.2cto.com #git config --global user.name "username" #git config --global user.email [email protected] 生成key,默認會在/root/.ssh/id_rsa.pub,把裡面的所有內容都copy到github的accounting下面的ssh keys裡面 #ssh-keygen -C '[email protected]' -t rsa 3.提交項目 www.2cto.com #cd project_name #git init #git commit -m "test" #git add . #git remote add user_name [email protected]:xxx/xxx.git #git push user_name master user_name可以你自己指定 最初的時候我一直都是需要用戶名和密碼認證,提交失敗,返回403,然後是error,可以修改在你項目目錄下./git/config url = https://github.com/xxx/xxx.git ==>>修改 url = [email protected]:xxx/xxx.git 然後在你github上git地址采用ssh提交就行了。 更新本地代碼之後 #git status ==>> 可以查看當前代碼更新後狀態,是否提交到倉庫裡了 #git add . #git commit -m "test debug" #git push user_name master 你就可以在github上面看得更改歷史了
Copyright © Linux教程網 All Rights Reserved