Recent Posts
Recent Comments
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
In Total
관리 메뉴

A Joyful AI Research Journey🌳😊

git push -u origin master 본문

💻Bootcamp Self-Study Revision✨/Git, GitHub

git push -u origin master

yjyuwisely 2023. 7. 26. 16:07

pull the latest changes from the remote repository (GitLab) into your local repository:

git pull origin master

After pulling the changes, you can verify that your local repository is up-to-date by running:

git status

If you want to see what origin actually refers to, you can use the following command:

git remote -v

pwd(print making directory): 현재 디렉터리 확인
파일 삭제: rm [파일명]

https://wotres.tistory.com/entry/git-push-u-%EC%98%B5%EC%85%98-%EC%82%AC%EC%9A%A9-%EC%9D%B4%EC%9C%A0 

git push -u origin master

-u 옵션을 적어주면 앞으로 

master 라는 현재 브랜치를 자동으로 origin 이라는 원격저장소의 master 브랜치로 연결해
간단히 git push 만 입력하여 반영하거나
git pull 을 입력할 때 origin이라는 원격저장소의 master 브랜치를 
로컬 저장소의 master 브랜치로 merge 할수 있게 해주겠다는 의미



pwd
git init
git remote
git status
git commit -m "axios practice"
git add . 
git status 
git push -u origin main 
git config

inconus@inconusui-Macmini news-viewer % pwd     
/Users/inconus/news-viewer

inconus@inconusui-Macmini news-viewer % git init
Reinitialized existing Git repository in /Users/inconus/news-viewer/.git/

inconus@inconusui-Macmini news-viewer % git remote
origin

inconus@inconusui-Macmini news-viewer % git add . 

inconus@inconusui-Macmini news-viewer % git status
On branch main
nothing to commit, working tree clean

inconus@inconusui-Macmini news-viewer % git commit -m "axios practice"
On branch main
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   src/App.js
no changes added to commit (use "git add" and/or "git commit -a")

inconus@inconusui-Macmini news-viewer % git add .

inconus@inconusui-Macmini news-viewer % git status
On branch main
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   src/App.js

inconus@inconusui-Macmini news-viewer % git commit -m "axios practice"
[main 7eeb796] axios practice
 1 file changed, 1 insertion(+), 1 deletion(-)
 
inconus@inconusui-Macmini news-viewer % git push -u origin main 
To https://github.com/yjyuwisely/TheArtofReact
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/yjyuwisely/TheArtofReact'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

inconus@inconusui-Macmini news-viewer % git pull origin main
From https://github.com/yjyuwisely/TheArtofReact
 * branch            main       -> FETCH_HEAD
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint: 
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.

inconus@inconusui-Macmini news-viewer % git config
usage: git config [<options>]

Config file location
    --global              use global config file
    --system              use system config file
    --local               use repository config file
    --worktree            use per-worktree config file
    -f, --file <file>     use given config file
    --blob <blob-id>      read config from given blob object

Action
    --get                 get value: name [value-pattern]
    --get-all             get all values: key [value-pattern]
    --get-regexp          get values for regexp: name-regex [value-pattern]
    --get-urlmatch        get value specific for the URL: section[.var] URL
    --replace-all         replace all matching variables: name value [value-pattern]
    --add                 add a new variable: name value
    --unset               remove a variable: name [value-pattern]
    --unset-all           remove all matches: name [value-pattern]
    --rename-section      rename section: old-name new-name
    --remove-section      remove a section: name
    -l, --list            list all
    --fixed-value         use string equality when comparing values to 'value-pattern'
    -e, --edit            open an editor
    --get-color           find the color configured: slot [default]
    --get-colorbool       find the color setting: slot [stdout-is-tty]

Type
    -t, --type <type>     value is given this type
    --bool                value is "true" or "false"
    --int                 value is decimal number
    --bool-or-int         value is --bool or --int
    --bool-or-str         value is --bool or string
    --path                value is a path (file or directory name)
    --expiry-date         value is an expiry date

Other
    -z, --null            terminate values with NUL byte
    --name-only           show variable names only
    --includes            respect include directives on lookup
    --show-origin         show origin of config (file, standard input, blob, command line)
    --show-scope          show scope of config (worktree, local, global, system, command)
    --default <value>     with --get, use default value when missing entry

 

강제 푸시로 해결됐다. 

git push origin main -f

Cmd + Shift +를 누릅니다. (점). 이 키 조합을 누르면 모든 숨겨진 폴더와 파일이 표시됩니다. 


https://www.lainyzine.com/ko/article/git-init-how-to-initialize-git-repository/

 

git init으로 Git 저장소를 생성하는 방법

Git으로 소스 코드를 관리하고 협업을 하려면 먼저 git init으로 저장소를 생성해야합니다. 이 글에서는 git init으로 저장소를 초기화하고 첫 커밋하는 방법을 소개합니다. 첫 커밋한 내용을 GitHub에

www.lainyzine.com

https://backlog.com/git-tutorial/kr/stepup/stepup3_2

728x90
반응형
Comments