You need to configure Git only once per user per computer (with the
git config --global user.name "John Doe" git config --global user.email "firstname.lastname@example.org"
Clone a repository to your local machine
On YouSource, first browse to your repository. There you can find two cloning urls. One of them allows only cloning and pulling (read-only) and the other one allows pushing as well (read and write).
git clone email@example.com:your_project/your_repo.git your_repo # Read and write cd your_repo
After you have cloned your repository, the url is automatically stored and you can refer to it by the name
origin when using such Git commands as push or pull.
Tip: Read-only urls always start with
'git://' and read and write urls start with
Add an existing (local) project under Git repository
cd /path/to/your/project git init . # Initialize a Git repository git add . # Add all your project files git commit -m 'Describe your changes shortly' # Store a version of your project locally
Make your local repository track a repository on YouSource
To make your local repository track your repository on YouSource you can give it a name with which you can refer to it. Often the name is
origin which is assumed for example when you clone.
git remote add origin firstname.lastname@example.org:your_project/your_repo.git
After this you can refer to your repository on YouSource as
Push your local repository to YouSource
Push your local ‘master’ branch to your repository on YouSource:
git push origin master
Push all your local branches to YouSource:
git push --all origin
You can push even if the repository doesn’t exist on YouSource. Then it will created! Project is also created if it doesn’t exist already. When you create a repository by pushing, the name of the repository is defined in the url.
Here is an example:
git remote add origin email@example.com:new_or_existing_project/new_repo.git git push origin master
Update local repository from repository on YouSource
There are two commands which to use to get updates from a repository on YouSource. They are
git fetch and
git fetch updates your local repository’s list of remote branches and downloads branch data. It doesn’t do anything to your local branches though.
git pull fetches data for the current branch from the remote repository and merges it to your current local branch.
Update local repository from remote repository called origin:
git fetch origin # This doesn't change your local branches
Update current local branch from remote repository called origin:
git pull origin master # Update local branch 'master' from remote branch 'master'
References to remote repositories are called remotes. Your local repository can track multiple remote repositories.
Display list of remotes:
Track another remote repo and set ‘second_origin’ as its name:
git remote add second_origin git://yousource.it.jyu.fi/project/repo.git
Change the url for a remote:
git remote set-url second_origin firstname.lastname@example.org:project/repo.git
Rename a remote:
git remote rename second_origin temp_origin # Rename 'second_origin' to 'temp_origin'
Remove a remote (doesn’t remove the repository itself of course):
git remote rm temp_origin