You can rename file using rename(String sourceRegEx, String replaceWith).
task myCopyTask(type: Copy) {
into 'other-folder'
from ('github-source-code') {
rename '*gitignore', 'other-name'
}
}
For more information is available Copy DSL.