轉載地址:http://my.oschina.net/lujianing/blog/180728
1.下載github for window
2.設置相關綁定
Settings ——Version Control——Git——Path to Git executable——選擇你的安裝目錄
C:\Users\Administrator\AppData\Local\GitHub\PortableGit_0f65d050d0c352fd38a0b25d82ee942deb19ef87\bin\git.exe
Test
Settings ——Version Control——GitHub
Host:github.com Login:賬號 Password:密碼
Test
3.項目的本地git提交
intellij內部集成了git版本控制 所以在本地可以直接進行使用
3.1創建本地倉庫
3.2提交代碼到本地git
右鍵項目或者文件 Git——Add——Commit (先add 然后再提交)
4.配置遠程提交
4.1 github上創建倉庫
4.2 Git Shell中配置遠程倉庫
cd 項目目錄
git remote add origin https://github.com/lujianing/ueditor.git
git push -u origin master
1.fatal: remote origin already exists
git remote rm origin
2.error: Could not remove config section 'remote.origin'
需要修改gitconfig文件的內容 找到github的安裝路徑,我是
C:\Users\Administrator\AppData\Local\GitHub\PortableGit_6d98349f44ba975cf6c762a720f8259a267ea445\etc
找到一個名為gitconfig的文件,打開它把里面的[remote "origin"]那一行刪掉
重啟gitshell 執行上述操作
4.3 Intellij IDEA中進行push/pull
右鍵項目 Git——Repository——Push
在開發過程中 我們可以使用本地的git進行版本管理 最后使用push進行遠程提交
4.4 多人協作開發
在Github 項目的 settings——Collaborators 下可以添加項目成員
被添加的用戶 可以提交代碼到當前項目中
5.另一種簡單方法
在github上創建倉庫后 復制倉庫地址 比如 https://github.com/lujianing/demo.git
在intelij中 VCS——Checkout from Version Contrl——Git中 粘貼倉庫url地址
會從github倉庫中拷貝一份項目 然后就可以在本地直接進行git操作
並且可以push到github倉庫中 (會提示你輸入github的倉庫和密碼)