Recent Changes


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> which appears on “access for developers”.)

git clone git://<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

SSH hosy key finger prints are bellow:

SSH version 2 (RSA)SHA256:uKMD1XyGiRCd6QyzCpvlJ5ME79d939Z1Frdua9uZEUE
SSH version 2 (EDCSA)SHA256:9K7tpuAFYBPZdA0DhEJGTGbzDU63vXHVYdtgf7sEArc
SSH version 2 (ED25519)SHA256:Zvhg5QZkdPGUR7tOa+xG3txNwFTZCWpOhJKVMAs8H04

First, register SSH public key on the “User Settings” page. You can use either of the SSH2 (rsa, edcas, ed25519) 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.

  • Name of the repository
  • Summary

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 ( ).

git config --global <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.
	email = <loginname>

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 for the “--global” option, then go to that repository and use the command like the one above to set up

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 push
will 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><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><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><projectname>/<repositoryname>

then from next time, all you need is a short command like the one below.

git push osdn

Migrate from GitHub repository

Migratiion sample from GitHub repository to OSDN project git repos.

The following conditions are assumed for explanation.

  • You already register OSDN project for migration (Eample project name is project_example)
  • You already have local clone of target git repository. (Example local repository path name is /home/foo/GITHUB_REPO1)

Create new git repository on the project

You need empty project git repository. So create the new one. Access to project git repository admin page in the project Source Code menu, then click new repository button on top right of the page for register new git repository.

Please wait a few minutes to be created the repository on the OSDN server.

(Example git repository name is example1)

Check repository access URL

When repository is created, please access repository viewer page to check the git repository access URL

Click SSH button on the top right of the page to show the repository access URL via SSH and copy it.

OSDN git acccess via SSH URL has the following format:

Write to OSDN repository

You can write to the OSDN repository from the local repos with command bellow.

cd /home/foo/GITHUB_REPO1
git push

You can push the local repo to OSDN repo. But on this command you should write the access URL itself, it is too long. To solve it, you can add shortcut remote name alias.

git remote add osdn

After remote shotrcut alias name is added, you can push to OSDN repo as bellow.

git push osdn

If you do not adjust any settings, the local repository cloned from a remote have origin remote shortcut alias. It is pointed to remote URL of cloned from. And origin remote is set as default remote.

So, If you push without URL or remote shotrcut name git push data to the origin.

If you want to change default remote to OSDN repo, you can use -u option for push to update it.

git push -u osdn

After the command, default remote will be change from origin to osdn remote. You can push to osdn without any options.

git push

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.

If 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
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.