I'm testing and developing in an OpenShift All-in-One cluster in a VM. I needed my local working branch of a git repository cloned in my VM. I compiled bits and pieces of my web search into this post, so hopefully when the next developer searches the title of this blog they'll find this!
Substitute in the commands below:
REPO=repoToClone
WORKING_BRANCH=workingBranchName
BARE_REPO="$REPO-bare"
PATH_TO_REPOS=/path/to/your/repo
REPO_PATH=/path/to/your/repo/$REPO
BARE_REPO_PATH=/path/to/your/repo/$BARE_REPO
PUBLIC_DNS_OF_VM
VM_USER=output of 'echo ${USER}' from VM
Run these commands while ssh'd into the VM. I recommend putting these in a script so you can easily sync your local repositories to your VM whenever necessary:
sudo mkdir -p $PATH_TO_REPOS
sudo chown -R $USER:$USER $PATH_TO_REPOS
cd $PATH_TO_REPOS
git init --bare $BARE_REPO
git clone $BARE_REPO_PATH $REPO_PATH
cd $REPO
touch file.txt && git add . && git commit -m 'added a file so I could create a working branch'
git push origin master
Here is output of the above commands:
In local machine, clone your git repository to the VM $BARE_REPO:
cd $REPO_PATH
git push -q ssh://$VM_USER@$PUBLIC_DNS_OF_VM$BARE_REPO_PATH --force --verbose
Here is output from the git push:
SSH back into VM and run these:
cd $REPO_PATH
git pull (this will open a git vim window, enter 'wq' to continue merge)
git checkout $WORKING_BRANCH
Finally, here is a screenshot of the repository contents and branch name in the VM:
You now have your current local working branch of a git repository cloned to your VM :)
์ ์ ์๊ฐ
Sally Ann O'Malley is a Principal Software Engineer, Emerging Technologies, Office of the CTO at Red Hat. She uses her talent for sparking excitement around new tools and ideas to integrate innovative solutions into Red Hat's portfolio. Sally is an organizer for DevConf.US, an annual open source conference, and an instructor within Boston University's Faculty of Computing and Data Sciences.
์ ์ฌํ ๊ฒ์ ๊ฒฐ๊ณผ
๊ท์ฌ์ ์ ํ๋ฆฌ์ผ์ด์ ํ๋ซํผ์ ๋ฏธ๋์ ๋๋น๋์ด ์๋์?
์ ๋ฌธ์ฑ์ ๊ฒ์ฆํ๋ ์๋ก์ด ๊ธฐ์ค: Red Hat ์๊ฒฉ์ฆ ์ฃผ์ ์ ๋ฐ์ดํธ
Talking to Machines: LISP and the Origins of AI | Command Line Heroes
The Truth About Netcode | Compiler
์ฑ๋๋ณ ๊ฒ์
์คํ ๋ฉ์ด์
๊ธฐ์ , ํ, ์ธํ๋ผ๋ฅผ ์ํ IT ์๋ํ ์ต์ ๋ํฅ
์ธ๊ณต์ง๋ฅ
๊ณ ๊ฐ์ด ์ด๋์๋ AI ์ํฌ๋ก๋๋ฅผ ์คํํ ์ ์๋๋ก ์ง์ํ๋ ํ๋ซํผ ์ ๋ฐ์ดํธ
์คํ ํ์ด๋ธ๋ฆฌ๋ ํด๋ผ์ฐ๋
ํ์ด๋ธ๋ฆฌ๋ ํด๋ผ์ฐ๋๋ก ๋์ฑ ์ ์ฐํ ๋ฏธ๋๋ฅผ ๊ตฌ์ถํ๋ ๋ฐฉ๋ฒ์ ์์๋ณด์ธ์
๋ณด์
ํ๊ฒฝ๊ณผ ๊ธฐ์ ์ ๋ฐ์ ๊ฑธ์ณ ๋ฆฌ์คํฌ๋ฅผ ๊ฐ์ํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์ต์ ์ ๋ณด
์ฃ์ง ์ปดํจํ
์ฃ์ง์์์ ์ด์์ ๋จ์ํํ๋ ํ๋ซํผ ์ ๋ฐ์ดํธ
์ธํ๋ผ
์ธ๊ณ์ ์ผ๋ก ์ธ์ ๋ฐ์ ๊ธฐ์ ์ฉ Linux ํ๋ซํผ์ ๋ํ ์ต์ ์ ๋ณด
์ ํ๋ฆฌ์ผ์ด์
๋ณต์กํ ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ํ ์๋ฃจ์ ๋ ๋ณด๊ธฐ
๊ฐ์ํ
์จํ๋ ๋ฏธ์ค์ ํด๋ผ์ฐ๋ ํ๊ฒฝ์์ ์ํฌ๋ก๋๋ฅผ ์ ์ฐํ๊ฒ ์ด์ํ๊ธฐ ์ํ ์ํฐํ๋ผ์ด์ฆ ๊ฐ์ํ์ ๋ฏธ๋