Git을 사용하여 원격 저장소에 초기 푸시를 어떻게 수행합니까?
나는 수많은 튜토리얼을 읽었으며 계속해서 짧게 나옵니다. 내가 가진 것은 다음과 같습니다.
-Windows 데스크톱에서 RubyMine을 실행하고 있습니다.- 지침에
따라 WebFaction 호스팅 계정에 Git을 설치했습니다-Git이 두 컴퓨터에서 모두 제대로 작동하는 것 같습니다
내가하고있는 일은 다음과 같습니다.
1. 서버에서 :
a. mkdir 프로젝트
b. 자식 초기화
c. git add.
디. git commit <--- "nothing to commit"
2
. 클라이언트에서 : a. RubyMine에서 새 프로젝트를 작성하십시오.
비. 프로젝트의 최상위 디렉토리에있는 "git init"
c. "변경 사항을 푸시하십시오"서버 <---- "일부 참조를 푸시하지 못했습니다 ..."
어떤 단계를 놓치고 있습니까?
서버에서 :
mkdir my_project.git
cd my_project.git
git --bare init
클라이언트에서 :
mkdir my_project
cd my_project
touch .gitignore
git init
git add .
git commit -m "Initial commit"
git remote add origin youruser@yourserver.com:/path/to/my_project.git
git push origin master
원점을 추가 할 때 사용할 수있는 몇 가지 형식과 스키마가 있습니다. 귀하의 호스팅 서비스가 제공하는 것을 참조하십시오.
당신은 이것을 시도 할 수 있습니다 :
서버에서 :
/etc/group
좋아요에 새 그룹 추가 (예)
mygroup:1001:michael,nir
새로운 자식 저장소를 만듭니다.
mkdir /srv/git
cd /srv/git
mkdir project_dir
cd project_dir
git --bare init (initial git repository )
chgrp -R mygroup objects/ refs/ (change owner of directory )
chmod -R g+w objects/ refs/ (give permission write)
클라이언트에서 :
mkdir my_project
cd my_project
touch .gitignore
git init
git add .
git commit -m "Initial commit"
git remote add origin youruser@yourserver.com:/path/to/my_project.git
git push origin master
(클라이언트 측의 Josh Lindsey에게 감사합니다)
클라이언트 다음에 서버에서 다음 명령을 수행하십시오.
cd /srv/git/project_dir
chmod -R g+w objects/ refs/
git pull 후이 오류가 발생하면 :
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 new origin/<branch>
시험:
git push -u origin master
도움이 될거야.
커밋하기 전에 저장소에 파일 을 하나 이상 추가해야합니다 ( 예 :) .gitignore
.
프로젝트에 업스트림 분기가없는 경우, 즉 원격 저장소가 로컬 저장소에서 작성된 분기에 대해 처음 알게되는 경우 다음 명령이 작동해야합니다.
git push --set-upstream origin <branch-name>
@Josh Lindsey는 이미 완벽하게 대답했습니다. 그러나 종종 ssh를 사용하기 때문에 정보를 추가하고 싶습니다.
따라서 변경하십시오.
git remote add origin youruser@yourserver.com:/path/to/my_project.git
에:
git remote add origin ssh://youruser@yourserver.com/path/to/my_project
도메인과 경로 사이의 콜론은 더 이상 존재하지 않습니다.
클라이언트에서 원격 저장소를 설정해야합니다.
git remote add origin ssh://myserver.com/path/to/project
'Programming' 카테고리의 다른 글
Android에서 GPS를 프로그래밍 방식으로 활성화 또는 비활성화하려면 어떻게해야합니까? (0) | 2020.06.12 |
---|---|
Assert () 메소드의 기능은 무엇입니까? (0) | 2020.06.12 |
Ruby on Rails : 문자열을 HTML로 렌더링하는 방법? (0) | 2020.06.12 |
두 날짜 사이의 근무일 계산 (0) | 2020.06.12 |
C ++과 Java에서 "일반"유형의 차이점은 무엇입니까? (0) | 2020.06.12 |