How to Use Git
Through the use of web interface, you can browse Git repository for commits and files.
If you want to use Git commands and tools to access, load with HTTP and Git protocol (port 9418). Then you can both read and write via HTTP and SSH.
Load Contents from Git Repository
If there's a Git repository in your project, the Git repository will appear on the project's “source code” tab. By clicking that tab, you can browse it via web interface. Also, if you select “source code” - “guide”, you can browse all the repositories set up by the project, and you can find the Git repository from there.
If you want to obtain the source of a certain project by using commands, do as shown below. (caution: If you choose this way to clone, you won't be able to push it to the origin as it is. In a situation where you are the developer, use <loginname>@git.osdn.net:/gitroot/... which appears on “access for developers”.)
git clone git://git.osdn.net/gitroot/<projectname>/<repositoryname>
How to commit to Git Repository
Members of the project have the right to commit to the Git repository.
1 Set up the SSH Environment
First, register SSH public key on the “User Settings” page. You can use either of the SSH1/2 (rsa, dsa) keys. Be careful with the length of the key which should fit in a line. Otherwise, the key doesn't get copied correctly.
It will take about a few minutes to enable the registered key.
2. Create a New Git Repository
To create a new Git repository, go to the “Source Code” - “Git Admin” page, from the project menu. Then click on the “Create new Git repository” and enter the following items.
Next, click the “Create new Git repository” button to create a Git repository. It will take about a few minutes.
3. Make Preparation on Local Repository
With your local Git repository, set up an e-mail address. Currently, contributions to Git repository are logged based on the registered e-mail address ( firstname.lastname@example.org ).
git config --global user.email <registered e-mail address>“--global” option will affect the entire Git environment, so if you intend to register only a certain repository, then go to the directory of that repository and execute without the “--global” option. In that case, it will appear on .git/config to look something like this.
[user] email = <loginname>@users.osdn.me
3-1 To Migrate from Other Repository
Before you register what's on other repository to OSDN, create a local repository.
git clone git://<other repository>If you haven't set up user.email for the “--global” option, then go to that repository and use the command like the one above to set up user.email.
4 Commit to the Git Repository
Now that you're ready, let's contribute to the Git repository you just created.
If you are cloning via SSH, then simply
git pushwill send the changes to OSDN.
If you want to clone from another area or send a new content created on the local repository, go to the “source code” - “Guide and History” page to refer to the command examples listed in the “Access designed for developers through the use of SSH” column.
For example, if you are pushing, it would look something like this.
git push <loginname>@git.osdn.net:/gitroot/<projectname>/<repositoryname>
By the way, when the Git repository has just been created (Git repository is empty), there are no branch names registered, so you can not write like the example above. In this case, execute it with “--mirror” option or put a branch name, such as master, to execute.
git push <loginname>@git.osdn.net:/gitroot/<projectname>/<repositoryname> master
4-1 Abbreviate a long Git URL
Once you register a URL, like how it's done below,
git remote add osdn <loginame>@git.osdn.net:/gitroot/<projectname>/<repositoryname>
then from next time, all you need is a short command like the one below.
git push osdn
Cautions on when you are operating on Windows
When you are using “Git on Msys” on Windows, in this binary package, the below items are set up as the system default.
core.symlinks=false core.autocrlf=true color.diff=auto pack.packsizelimit=2gIf you put “core.autocrlf=true”, the line break code LF gets replaced with CRLF while file hierarchy gets structured from repository object. So if you use LF intentionally, it gets changed during every commit. To disable core.autocrlf, execute the commands below.
git config --system core.autocrlf false or git config --system --unset-all core.autocrlf
If you wish to not change the setting for the whole system, use --global instead of --system, or simply delete the option.