scmgit-intro
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
scmgit-intro [2021/03/12 22:10] – [Introduction] hc9 | scmgit-intro [2024/09/16 07:39] (current) – it” hc9 | ||
---|---|---|---|
Line 10: | Line 10: | ||
* create a public readonly copy of your repository | * create a public readonly copy of your repository | ||
- | The best reason why a person would use git instead of cvs or svn is that git does not require a central server. For example, let's say you were taking out a CVS repository to your laptop and would not be able to connect to the server for a month. When you get back, that entire months worth of work is seen as a single diff. Which you would have to merge by hand to the other changes, but also you couldn' | + | The best reason why a person would use git instead of cvs or svn is that git does not require a central server. For example, let's say you were taking out a CVS repository to your laptop and would not be able to connect to the server for a month. When you get back, that entire months worth of work is seen as a single diff. Which you would have to merge by hand to the other changes, but also you couldn' |
===== Configuring your account to use git on sdf ===== | ===== Configuring your account to use git on sdf ===== | ||
Line 26: | Line 26: | ||
===== Creating a central git repository on SDF ===== | ===== Creating a central git repository on SDF ===== | ||
- | I suggest creating a subdirectory that will hold nothing but your git repositories.. let's say it's ~/git. The server copy of the git repository need not be a useable repository (IE, the files under revision control do not need to exist.. we just need the git database to exist so we can clone from it). Under git this is called a "bare" | + | I suggest creating a subdirectory that will hold nothing but your git repositories.. let's say it's ~/git. The server copy of the git repository need not be a useable repository (IE, the files under revision control do not need to exist.. we just need the git database to exist so we can clone from it). Under git this is called a “bare” repository. |
==== Create the server repository ==== | ==== Create the server repository ==== | ||
Line 36: | Line 36: | ||
| | ||
</ | </ | ||
+ | |||
Note that the path is arbitrary and can be anywhere in your home directory. This can be done either on the Meta Array or on the main cluster. | Note that the path is arbitrary and can be anywhere in your home directory. This can be done either on the Meta Array or on the main cluster. | ||
- | And that's it! on the server side. This remains empty until you first "push" | + | And that's it! on the server side. This remains empty until you first “push” your project to the server. |
===== Creating your local git repository. ===== | ===== Creating your local git repository. ===== | ||
Line 56: | Line 57: | ||
| | ||
</ | </ | ||
- | Now your repository is initialized! Time to check in your current project. First we add the files to the repository. I like to manually add each file instead of doing a "commit all" | + | |
+ | Now your repository is initialized! Time to check in your current project. First we add the files to the repository. I like to manually add each file instead of doing a “commit all” because | ||
< | < | ||
Line 63: | Line 65: | ||
| | ||
</ | </ | ||
+ | |||
If the commit failed, follow the directions onscreen to configure your username and email so git can track you as a user in the repository. | If the commit failed, follow the directions onscreen to configure your username and email so git can track you as a user in the repository. | ||
Line 72: | Line 75: | ||
| | ||
</ | </ | ||
+ | |||
Or, if you created your repo on the Meta Array, set up your remotes like this: | Or, if you created your repo on the Meta Array, set up your remotes like this: | ||
Line 79: | Line 83: | ||
| | ||
</ | </ | ||
+ | |||
Git should ask for your password, and then tell you it uploaded the objects and that everything succeeded.\\ | Git should ask for your password, and then tell you it uploaded the objects and that everything succeeded.\\ | ||
If not, ask on the sdf forum for advise. | If not, ask on the sdf forum for advise. | ||
Line 94: | Line 99: | ||
===== Backing up all your existing git repos to a remote server ===== | ===== Backing up all your existing git repos to a remote server ===== | ||
- | sdf doesn' | + | sdf doesn' |
Here is a script that will, in sequence: | Here is a script that will, in sequence: | ||
Line 130: | Line 135: | ||
fi | fi | ||
</ | </ | ||
- | Note: For the FTP to work, edit your ~/.netrc file so that ftp.your-host.com has an entry that looks like:\\ | ||
+ | Note: For the FTP to work, edit your ~/.netrc file so that ftp.your-host.com has an entry that looks like: | ||
< | < | ||
Line 139: | Line 144: | ||
bin | bin | ||
</ | </ | ||
- | Also ensure to run "chmod 600 ~/.netrc" | + | |
+ | Also ensure to run “chmod 600 ~/.netrc” to hide your credentials to the rest of the world :). Now add this to your (daily or less) cron tasks with mkcron (MetaARPA only, just like git ;) and enjoy your timely backups! | ||
===== Updating your local copy with changes made to the repo ===== | ===== Updating your local copy with changes made to the repo ===== | ||
Line 160: | Line 166: | ||
Once you have your repo setup for you to do your work in, you may have a need to make your work public. Making it public allows for other users to pull specific version of your project without having to have development rights. A slight modification to your repo is needed and some webspace to host it.\\ | Once you have your repo setup for you to do your work in, you may have a need to make your work public. Making it public allows for other users to pull specific version of your project without having to have development rights. A slight modification to your repo is needed and some webspace to host it.\\ | ||
- | |||
==== Setup some webspace ==== | ==== Setup some webspace ==== | ||
Line 167: | Line 172: | ||
\\ | \\ | ||
'' | '' | ||
- | |||
==== hooks/ | ==== hooks/ | ||
- | In your repo directory for the project there is a directory that contains a set of scripts which are called at different times during your interaction with git. For more information about the "hooks" | + | In your repo directory for the project there is a directory that contains a set of scripts which are called at different times during your interaction with git. For more information about the “hooks” directory check out [[http:// |
The script we will need to modify is post-update. This script is called after an update has occured on the server side of your repo. | The script we will need to modify is post-update. This script is called after an update has occured on the server side of your repo. | ||
Line 234: | Line 238: | ||
$ | $ | ||
</ | </ | ||
- | In the above example there is a new line labled | + | |
+ | In the above example there is a new line labled | ||
**Private Access:** git clone user@sdf.org: | **Private Access:** git clone user@sdf.org: | ||
Line 272: | Line 277: | ||
sdf-dev sdf-dev.pub | sdf-dev sdf-dev.pub | ||
</ | </ | ||
+ | |||
==== Create a git access script ==== | ==== Create a git access script ==== | ||
Line 280: | Line 286: | ||
exec git-shell -c " | exec git-shell -c " | ||
</ | </ | ||
+ | |||
The '' | The '' | ||
Line 289: | Line 296: | ||
command="/ | command="/ | ||
</ | </ | ||
+ | |||
All the '' | All the '' | ||
Line 295: | Line 303: | ||
merging/ | merging/ | ||
Best look online for more in-depth tutorials.. I haven' | Best look online for more in-depth tutorials.. I haven' | ||
- | \\ | ||
- | |||
$Id: scmgit-intro.html, | $Id: scmgit-intro.html, | ||
Line 306: | Line 312: | ||
Originally appeared at https:// | Originally appeared at https:// | ||
+ |
scmgit-intro.1615587003.txt.gz · Last modified: 2021/03/12 22:10 by hc9