coding倉庫與本地工程建立聯(lián)系

1.前提:已經(jīng)建立遠(yuǎn)程coding倉庫

coding建立倉庫

2.git命令行的正常使用

1.遠(yuǎn)程倉庫coding克隆到本地

     cd /Users/yourMacName/Desktop/新建文件
     git clone https://coding.net/yourusername/projectname.git 

2.本地倉庫添加文件,并提交到遠(yuǎn)程倉庫

      git add yourfile
      git commit -m'your message'
      git push
3.遠(yuǎn)程倉庫有更新,同步到本地倉庫
      git pull
4.刪除遠(yuǎn)程倉庫文件(遠(yuǎn)程倉庫與本地倉庫已經(jīng)建立關(guān)聯(lián))
      git rm your file
      git commit -m'delete yourfile'
      git push
5.注意:以上的方法,會把遠(yuǎn)程倉庫的最外層文件夾帶來,產(chǎn)生的路徑如下
      /Users/yourMacName/Desktop/新建文件/yourProjectFiles/yourfile

3.不帶倉庫最外層的文件夾(圖1和圖2的區(qū)別)

圖1
圖2
1.初始化本地git倉庫
     git init
    rm -rf .git//刪除git init
2.關(guān)聯(lián)遠(yuǎn)程倉庫

方法1:直接替換遠(yuǎn)程倉庫連接

     cd /Users/yourMacName/Desktop/測試版
     git remote set-oldURL origin <newURL> 

方法2:先刪后加

     cd /Users/yourMacName/Desktop/測試版
     git remote rm origin 
     git remote add origin https://coding.net/yourProject/test

方法3:修改config文件

     cd /Users/yourMacName/Desktop/測試版
     git remote -v:顯示當(dāng)前所有遠(yuǎn)程庫的詳細(xì)信息
     git config -e
3.push,pull,delete操作
     git add yourfile
     git commit -m'your message'
     git push

     git rm yourfile
     git commit -m'delete yourfile'
     git push
 
     git pull
4.其他命令行
      git config --global user.name 'your Name'
      git config --global user.email 'your Email'
      git config --list //查看config
      git config --global --replace-all user.email "輸入你的郵箱"http://修改email/name/password
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
 
git push --set-upstream origin master

//使用git在本地新建一個(gè)分支后,需要做遠(yuǎn)程分支關(guān)聯(lián)。如果沒有關(guān)聯(lián),git會在下面的操作中提示你顯示的添加關(guān)聯(lián)
//解決辦法 已經(jīng)在上面提示出來了

      git push --set-upstream yourGit
  • 如果git pull后 ,出現(xiàn)一下錯(cuò)誤
From https://e.coding.net/tucici/SkyLineSDK
 * [new branch]      master     -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master
  • 解決:
    git branch --set-upstream-to=origin/master master (master為遠(yuǎn)程默認(rèn)分支的名稱,)
  • 如果爆錯(cuò):fatal: branch 'master' does not exist。
    解決:git pull origin master --allow-unrelated-histories:
     git pull origin V1.1 --allow-unrelated-histories
    
  • 報(bào)錯(cuò)error: The following untracked working tree files would be overwritten by merge: .DS_Store
    解決:
    • git clean -d -fx
    • git pull origin master --allow-unrelated-histories

svn/git提交的狀態(tài)解決(出現(xiàn)?!~字符)
終端命令行使用svn

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容