If you clone a lot of Xfce repositories, you can set a shortcut so you don't have to type out the full URL all the time. Simply run:
git config --global 'url.ssh://git.xfce.org/git/.insteadOf' xfce:
After this, you'll be able to do, for example:
git clone xfce:xfce/xfdesktop
and Git will automatically rewrite it to the correct URL. You can of course do this with git: and http: URLs as well.
If your ssh username is not the same as your local username, you can make an entry in
$HOME/.ssh/config (create it if it doesn't exist) so you don't have to type it each time:
Host git.xfce.org User $USERNAME
Of course, replace
$USERNAME with your actual username.
If you have a relatively new version of Git on your machine, you may get this message after running
warning: You did not specify any refspecs to push, and the current remote warning: has not configured any push refspecs. The default action in this warning: case is to push all matching refspecs, that is, all branches warning: that exist both locally and remotely will be updated. This may warning: not necessarily be what you want to happen. warning: warning: You can specify what action you want to take in this case, and warning: avoid seeing this message again, by configuring 'push.default' to: warning: 'nothing' : Do not push anything warning: 'matching' : Push all matching branches (default) warning: 'tracking' : Push the current branch to whatever it is tracking warning: 'current' : Push the current branch
This warning is harmless, but you might want to change the value both to make your pushes “safer” and to get rid of the warning. Personally, I set mine to “tracking”:
git config --global push.default tracking
My rationale here is:
git push origin master).
Git, annoyingly, requires you to know a few magic incantations when you push code to a brand-new remote repository. We'll assume that you've already created a local repository using
git init, have added files with
git add, and have made some commits with
git commit. After that, you need to add a remote to point to the repository on the server. By convention, the default remote is called
git remote add origin $REPOSITORY_URL
Of course, replace
$REPOSITORY_URL with the URL of the repo you want to push to.
If the remote repository is completely empty and has no commits in it, you have to explicitly tell git what source branch you want to push (
master) and where it should go on the remote (
git push origin master:refs/heads/master
From now on, all you'll have to do is
git push origin. If you want to make it even easier, you can set up some configuration to automatically decide where to push:
git config branch.master.remote origin git config branch.master.merge refs/heads/master
From now on, you can just do
git push and it will know what to do. When you clone a remote repository, these two configuration entries are set up for you automatically, but since you started with a self-created local repository, this couldn't happen.